Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

How to convert Set Analysis make it able to dynamic on date ?

Hi All

Marcus have help me with the below script , which work fine for Qlik Sense because in QS it does not encourage user to select month and year.

LY YTD =

sum({$<eXP={'eXP'}, date={">=$(=num(AddYears(YearStart(Today()), -1)))<=$(=num(AddYears(Today(), -1)))"}>} Amount)

YTD =

sum({$<eXP={'eXP'}, date={">=$(=num(YearStart(Today())))<=$(=num(Today()))"}>} Amount)

Now i want to implement the similar script in Qlik View , which allow user to select month and year.

I hope some one can help me convert the above script into more dynamic script , which allow to allow user change the month and year. Meaning can select month =12 and year = 2013 for view the sales change from 2012 to 2013.

Paul

1 Solution

Accepted Solutions
sunny_talwar

May be this:

LY YTD =

sum({$<eXP={'eXP'}, date={">=$(=num(AddYears(YearStart(Max(date)), -1)))<=$(=num(AddYears(Max(date), -1)))"}, year =, month =>} Amount)

YTD =

sum({$<eXP={'eXP'}, date={">=$(=num(YearStart(Max(date))))<=$(=num(Max(date)))"}, year =, month =>} Amount)


Update: add year =, month = as well

View solution in original post

3 Replies
paulyeo11
Master
Master
Author

Hi All

Enclosed my QV doc

sunny_talwar

May be this:

LY YTD =

sum({$<eXP={'eXP'}, date={">=$(=num(AddYears(YearStart(Max(date)), -1)))<=$(=num(AddYears(Max(date), -1)))"}, year =, month =>} Amount)

YTD =

sum({$<eXP={'eXP'}, date={">=$(=num(YearStart(Max(date))))<=$(=num(Max(date)))"}, year =, month =>} Amount)


Update: add year =, month = as well

sunny_talwar

See if the attached is what you were looking for.

Best,

Sunny