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: 
danimelo1
Creator
Creator

filter a variable

Hi all,

Is it possible to filter a variable? Eg: vMyvariable = Sum (sales)+Sum(Margin)

Then filter this variable by year:

Sum({<Year = {'2017'}>}vMyvariable)

Regards,

Daniel M

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Thats not possible directly

Sum cannot used against sum again.

The possible way is use the set analysis within the vMyvariable expression. Let me know if you are facing any issues with that.


Try the below, it might be work but not sure


Sum({<Year = {'2017'}>}Aggr(vMyvariable, Year))

View solution in original post

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Thats not possible directly

Sum cannot used against sum again.

The possible way is use the set analysis within the vMyvariable expression. Let me know if you are facing any issues with that.


Try the below, it might be work but not sure


Sum({<Year = {'2017'}>}Aggr(vMyvariable, Year))

devarasu07
Master II
Master II

Hi,

Try like this,

1) create a variable like below, let me know if any issues?

Alt(Sales,0)+Alt(Margin,0)

2)  Expression like this

SUM({<Year = {'2017'}>} $(Variable1))

Capture.JPG

giakoum
Partner - Master II
Partner - Master II

is Sum(Sales)+Sum(Margin) the same as Sum(Sales+Margin)?

if yes, you can have a variable to hold the 2 fields  as text and use $ to execute :

Variable1 : Sales+Margin

Expression : $(='Sum({<Year = {'2017'}>} ' & Variable1)