Always validate
Set expressions and alternate states can can get very complex, so it's a good practice to always validate the results thoroughly. Here are a few ways in which we can do that:
When using calculations in the element list definition, take the individual calculation out of the set expression and enter it into a text object to visualize its result and ensure that it's what you expect.
Once the set expression or state, has been constructed, play around and make a few selections to see how each affects the calculation and ensure it's what the user would expect.
When you've arrived at a result using a set expression, replicate the base expression, without the set portion, and try to arrive at the same result using only selections. If everything is correct, the result should always be the same, unless of course the modified record set cannot be replicated using selections only.