Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

SET expression how to make it display last 12 month ?

Hi All

I have below expression , which will compute the YTD monthly GP% trend.

1-

rangesum(above(sum({$<year = {$(=max(year))},SOURCE = {"TDSS"}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>} cost)/1000,0,rowno()))

/

rangesum(above(sum({$<year = {$(=max(year))},SOURCE = {"TDSS"}, month = {"<=$(=max({<year={$(=max(year))}>} month))"}>}sales)/1000,0,rowno()))

May i know how to modify the above so that it will display last 12 month GP% trend ?

Paul

3 Replies
sivarajs
Specialist II
Specialist II

This will gives you the last 12 month data

{$<month={">=$(=(max(month)-11))<=$(=Max(month))"}>}

er_mohit
Master II
Master II

Here Date is my fieldname if you don't have date field only month field then replace it as Month from all side

it gives you last 12 month data for no selection when you select coreesponding month,year then it gives you data depending upon selection

sum({$<Date = {">=$(=MonthStart(Max(Date), -12))<=$(=MonthEnd(Max(Date)))"},SOURCE = {"TDSS"},Year=,Month=>}Cost)

hope it helps

paulyeo11
Master
Master
Author

Hi All

Thank you very much for both of your advise.

I have try both your code for 2 hour , but i still unable to make it work.

Hope some one can advise me.

Paul