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

Add a filter when calling a variable $(Variable) in Set analysis

If I need to add the filter Year=2019 to the following variable in Set analysis?

$(Variable1)

What I am trying to do is something like this, but don´t know how to write it...

$({<Year={"2019"}>}Variable1)

Thanks in advance!!

5 Replies
Kushal_Chawda
MVP
MVP

If you want your variable always on latest year, create variable

vYear = max(Year)

then use set analysis like

=Sum({<Year={$(vYear)}>}Sales)

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

try like this

Sum({<Year={"2019"}>},$(Variable1)) 

Replace aggregation function according to your requirement

hope this helps 

Thanks

Thanks and Regards
Kashyap.R
luisccmm
Creator
Creator
Author

Thanks for your help @Kashyap_R , you seem to understand what I was looking for!!

But I´ve get an error, when I use your formula it says ')' expected.

Screenshot_1.pngScreenshot_2.png

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Try this 

Sum({<Year={'2019'}>}$(variable))

just syntax error

Hope this works and solve your problem

Thanks

Thanks and Regards
Kashyap.R
Kushal_Chawda
MVP
MVP

Based on your expression I can see that your variables have Count functions. You may need to use Aggr function to work this properly

=Sum({<Year={2019}>} aggr($(vNet Sales)-$(instaladas),Dimension1,Dimension2))

Where, Dimension1 & Dimension2  are the Dimensions you are having in the chart where you are using this expression.