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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Current Year Vs Prior Year Set Analysis not working

Hi Guys,

Current Year Vs Prior Year Set Analysis not working, it works if I hard code a year in or replicates the current year in the prior year set analysis.

Prior Year set analysis:

If(BusinessMetricName=1,num(sum({$<MC_Year={'=$(=GetFieldSelections(MC_Year)-1)'}>} [GWP Orig]),'#,##0'))

Current Year set analysis:

if(BusinessMetricName=1,num(sum([GWP Orig]),'#,##0'), ---------- gets Year from MC_Year selection.

Works perfect if hardcoded:

If(BusinessMetricName=1,num(sum({$<MC_Year={2016}>} [GWP Orig]),'#,##0'))



Thanks for the help that I know will come.

1 Solution

Accepted Solutions
sunny_talwar

Also, suggest using Max() instead of getfieldselections....

If(Only({1} BusinessMetricName) = 1, Num(Sum({$<MC_Year = {$(=Max(MC_Year)-1)}>} [GWP Orig]),'#,##0'))

View solution in original post

4 Replies
sunny_talwar

May be try this:

If(Only({1} BusinessMetricName) = 1,

Num(Sum({$<MC_Year = {'=$(=GetFieldSelections(MC_Year)-1)'}>} [GWP Orig]),'#,##0'))

sunny_talwar

Also, suggest using Max() instead of getfieldselections....

If(Only({1} BusinessMetricName) = 1, Num(Sum({$<MC_Year = {$(=Max(MC_Year)-1)}>} [GWP Orig]),'#,##0'))

Anonymous
Not applicable
Author

You're a star, what was I doing wrong?

sunny_talwar

BusinessMetricName did not have any set analysis so as soon as you selected 2017, the 2016 BusinessMetricName became null.... I just added Only({1} ...) around BusinessMetricName to ignore selections