Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
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!!

Labels (1)
5 Replies
Kushal_Chawda

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

vYear = max(Year)

then use set analysis like

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

kashyap
Partner
Partner

Hi 

try like this

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

Replace aggregation function according to your requirement

hope this helps 

Thanks

luisccmm
Creator
Creator
Author

Thanks for your help @kashyap , 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
Partner
Partner

Hi

Try this 

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

just syntax error

Hope this works and solve your problem

Thanks

Kushal_Chawda

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.