Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set analysis doesn't work

hi, I have this variable

=Max(Month)-1  (this results the number of the previus month)

and I'm trying to calculate the sales of the previous month, but the result is always 0

1 -  Sum({<Month={'$(PreviousMonth)'}>}[Sales])

2 -  Sum({<Month={$(=Max(Month)-1)}>} [Sales])

1 Solution

Accepted Solutions
marcus_sommer

Try it with: Sum({<MonthNum={"$(=Max(MonthNum)-1)"}>} [Sales])

than not only the values must be matching the formattings, too. And in general it's recommend to use only numeric fields for such a comparing or any other calculations.

- Marcus

View solution in original post

3 Replies
Chanty4u
MVP
MVP

try below

1. vCurrentMonth

=Max(Month)

and make ur expression like:

sum( {$<Year = {$(#vCurrentMonth)}>} Sales )

2. vLastMonth

=Max(Month-1)

sum( {$<Year = {$(#vLastMonth)}>} Sales )

marcus_sommer

Try it with: Sum({<MonthNum={"$(=Max(MonthNum)-1)"}>} [Sales])

than not only the values must be matching the formattings, too. And in general it's recommend to use only numeric fields for such a comparing or any other calculations.

- Marcus

Anonymous
Not applicable
Author

thanks, that works