Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Help required in the writing the below expression

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...

1 Solution

Accepted Solutions
Highlighted
Master III
Master III

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)

 

View solution in original post

2 Replies
Highlighted
Master III
Master III

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)

 

View solution in original post

Highlighted
Creator II
Creator II

Thanks! Yes did that somehow forgot there is a function called AddYears.