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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
stone1974
Contributor
Contributor

Using variable in Set Analysis

Hello!

I would like to use a variable in set analysis, like this way…

I have defined this variable in the data load editor


SET vPlanRevenue = (Sum(if(Plan.IsU = '1', Plan.costs)));


it works fine. If I use it in e.g. a textbox or table like this

$(vPlanRevenue)

it shows the revenue depending on the selected fiscal years (which is perfect).

But, if I would like to use it in a set analysis like this

(I would like to show the revenue of e.g. 2018, independent of selected filter)

Sum({1<FiscalYear={2018}>} $( vPlanRevenue))

it is not working.

Should it work, or I am completely on the wrong way?

Is there another way to show the revenue of 2018 with the vPlanRevenue variable?

I need the variable in further calculations, so I cant remove the sum().

Any help is appreciated.

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

you can not use nested aggregations..

rather change the base variable as

Sum({<Plan.IsU = {1}, FiscalYear={2018}>}Plan.costs)

View solution in original post

3 Replies
sasiparupudi1
Master III
Master III

you can not use nested aggregations..

rather change the base variable as

Sum({<Plan.IsU = {1}, FiscalYear={2018}>}Plan.costs)

sasiparupudi1
Master III
Master III

or

Sum({<Plan.IsU = {1}, FiscalYear={$1}>}Plan.costs)


in the expressions you can use it as


$(vPlanRevenue(2018))

jasonmomoa
Creator
Creator

Hi stone1974‌,

Can you try this instead

SET vPlanRevenue = IF(Plan.IsU='1', SUM(Plancosts), Null());