Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone:
I'm using this formula in set analysis to calculate the sales of my previous selected month:
SUM({$<Year= {$(=max(Year) - $(=if(max(Month) = 1, 1, 0)))},Month = {$(=if((Month) = 1, 12, only(Month)-1) )}, MonthYear = {"<=$(=max(MonthYear))"}>} Sales)
Does anyone can help me to modify this formula´, i need to show the sales of "N" Previous Months, because mine it only works when you select 1 month???
For example, if I select DEC,NOV,OCT of 2009, the formula has to show JUL,AUG,SEP of 2009
Regards
Carlos
OK, all it needs is for the date to be correctly formatted to match your MonthYear. In the attached example, that means putting it in MMM YYYY format. If that's the format you're using, use this:
sum({<Year=,Month=,MonthYear={"<$(=min(MonthYear)) >=$(=date(addmonths(min(MonthYear),-count(distinct MonthYear)),'MMM YYYY'))"}>} Sales)
Otherwise substitute your own format.
Hi John:
It works perfect, thanks for all your support.
Regards,
Carlos