Consider you have two separate tables with two fields for periods selection.
'Period1' and 'Period2'
Let's also assume that your period field named 'Period'.
Then to calculate the sum of some Value for Period1 you can use expression:
And for Period2
You can find more examples in help (look for 'set analysis').