Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Let's assume Snapshot Date is "25/05/2019" so the below expression gives the sales of Mar,2019 to May,2019
Sum({<Date={'>=$(=MonthStart(Max([Snapshot Date]),-2))<=$(=Date(MonthEnd(Max([Snapshot Date]))))'}>}Sales)
What should be the change in the expression if I want to get the sales same as above months but for next year and previous year (i,e Mar,2020 to May,2020 and Mar,2018 to May,2018)
Please help...
Use AddYears
to get last year
Sum({<Date={'>=$(=AddYears(MonthStart(Max([Snapshot Date]),-2),-1))<=$(=Date(AddYears(MonthEnd(Max([Snapshot Date])),-1)))'}>}Sales)
Next Year
Sum({<Date={'>=$(=AddYears(MonthStart(Max([Snapshot Date]),-2),1))<=$(=Date(AddYears(MonthEnd(Max([Snapshot Date])),1)))'}>}Sales)
Use AddYears
to get last year
Sum({<Date={'>=$(=AddYears(MonthStart(Max([Snapshot Date]),-2),-1))<=$(=Date(AddYears(MonthEnd(Max([Snapshot Date])),-1)))'}>}Sales)
Next Year
Sum({<Date={'>=$(=AddYears(MonthStart(Max([Snapshot Date]),-2),1))<=$(=Date(AddYears(MonthEnd(Max([Snapshot Date])),1)))'}>}Sales)
Thanks! Yes did that somehow forgot there is a function called AddYears.