Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scripting

Hi All,

Can anyone tell me how to calculate privious 12 months sales in script.

2 Replies
oscar_ortiz
Partner - Specialist
Partner - Specialist

You're going to have to be a bit more specific if you want any help with this...

Anonymous
Not applicable
Author

Kushal,

When creating my calendar table in my script, I usually have a line like this that creates a flag.

IF(TempDate >=ADDMONTHS(MonthStart($(varToday)),-11),1,0) AS Current12MonthFlag,

Then you can use set analysis to only pull sales for that flag:

SUM({<Current12MonthFlag={1}>}Sales)

Hope this helps!