Count the number of creatures on resolution of the spell and divide X by that number at that time. If the number of creatures changes before resolution, the damage done may be different than what you expected.