Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

stone1974
New 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.

Tags (2)
1 Solution

Accepted Solutions
sasiparupudi1
Honored Contributor III

Re: Using variable in Set Analysis

you can not use nested aggregations..

rather change the base variable as

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

3 Replies
sasiparupudi1
Honored Contributor III

Re: Using variable in Set Analysis

you can not use nested aggregations..

rather change the base variable as

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

sasiparupudi1
Honored Contributor III

Re: Using variable in Set Analysis

or

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


in the expressions you can use it as


$(vPlanRevenue(2018))

jasonmomoa
Contributor

Re: Using variable in Set Analysis

Hi stone1974‌,

Can you try this instead

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

Community Browser