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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis condition with variable in modifier

Hi all,

Can anyone provide an intuitive example of using variables in set analysis.

I know something like this works Sum  ({1< RollingMonthNum = {'$(vRollingCurentMonth)'}>} forcast) however if I wanted to get the sum of forecast for last 6 months based on my variable vRollingCurrentMonth how do I do it?

Example

RollingMonthRollingMonthNum
Mar-201341334
Feb-201341306
Jan-201341275
Dec-201241244
Nov-201241214
Oct-201241183
Sep-201241153
Aug-201241122
Jul-201241091
Jun-201241061
May-201241030
Apr-201241000
Mar-201240969
Feb-201240940
Jan-201240909
Dec-201140878
Nov-201140848

How can use set analysis to get a sum of past 6 months if my current variable vRollingCurrentMonth equals 41183.

Thanks,

G

1 Solution

Accepted Solutions
MayilVahanan

HI

Try like this

Sum  ({1< RollingMonthNum = {'>=$(=vRollingCurrentMonth)<=$(=Num(AddMonths(vRollingCurrentMonth,-5)))'}>} forcast)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
MayilVahanan

HI

Try like this

Sum  ({1< RollingMonthNum = {'>=$(=max(MonthNum))<=$(=Num(AddMonths(max(MonthNum),-5)))'}>} forcast)

Edit:

it calculate the forcast value from maximum of monthnum ..if u select the oct-2012, (i.e)41183.  then its calculate range from >=41183 to <= 41030

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi Mayil,

This works however by default it will show values based on current selection of the RollingMonth field and not the variable vRollingCurrentMonth. Is there a way to use the variable in the set analysis?

G

MayilVahanan

HI

Try like this

Sum  ({1< RollingMonthNum = {'>=$(=vRollingCurrentMonth)<=$(=Num(AddMonths(vRollingCurrentMonth,-5)))'}>} forcast)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Beautiful!

Thank you!

G