Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to apply selection to a Variable

Hi,

             I have a variable $(SumOfAmount), which is assigned with an aggregate function( SumOfAmount = Sum(AMOUNT)). How can we apply a selection to the variable "$(SumOfAmount)" without editing the definition of "$(SumOfAmount)".

            Attaching a application which i tried.

           Please advise.

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Sum({<[PERIOD_CODE]={'02'}>}Aggr($(SumOfAmount), PERIOD_CODE))

View solution in original post

4 Replies
dineshraj
Partner - Creator
Partner - Creator

Hi Bijoy,

I suggest you to use if condition.

if(<Selection_Field>='Selection_Name',$(Variable_Name))

Thanks and Regards.

jayaseelan
Creator III
Creator III

Hi Bijoy,

  Try if Condition in your expression you will get your output. In variable you used sum again you using sum in expression, so may some cases it will not work. Use following expression.

if([PERIOD_CODE]='02',$(SumOfAmount))

I have attached the QVF app, PFA.

Thanks,

ift_isabelle
Partner - Creator III
Partner - Creator III

Why would you take away the power of Qlik Sense?

My Solution would be: Make a Master Metric where you sum "Amount" and only select period 2 with set Analysis.

Like this: Sum({1<[PERIOD_CODE]={02}>} AMOUNT)

(If you change the '1' to '$' it will change when you change the dimension. With 1 it stays static, like it is now.)

sunny_talwar

May be this:

Sum({<[PERIOD_CODE]={'02'}>}Aggr($(SumOfAmount), PERIOD_CODE))