This expression will also give me the correct result if there is more than one action selected. For instance: if products A and B are marketed in April and products C and D in May, it gives me the sales of A+B in April and C+D in May.
I tried to create similar expressions to calculate the sales of different periods:
But this will give me the same result as the first expression and I have no idea why..
Then I created comparison date fields in the script for each action date, i.e. if Date=14/02/2015, there is a field Date_LastMonth=14/01/2015 and another for last year. Then I used the following expression:
This formula only works if I use 1, to represent the full set of records. If I use $ it will give me zero (would someone explain why?).
Another effect is that it only works if one action is selected - or else if they share the same store and products. If they don't, as in the example above, the expression gives the result of A+B+C+D in April and May.