Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sanchi21491
Contributor II
Contributor II

Using Variable in Filter Pane in Qlik Sense

Hello Qlikers,

I am facing challenges while using a variable in the Filter Pane of Qlik Sense. I wish to filter my dimensional values like Country, Address by Time(All Months|Previous Month), for which I created a Variable $(vTimePeriod).

How can I use this variable to filter my dimensional values in filter pane? Any ideas are appreciated!

Thanks!

1 Solution

Accepted Solutions
Kushal_Chawda

This will depend on the definition of what you have calculated in variable $(vTimePeriod)

Suppose you have calculated "max(Year)" in that variable, which gives value as "2019" then you can use this variable to filter any dimension in filter pane

for eg. you can use variable to filter product dimension like below

= aggr(only({<Year = {"$(vTimePeriod)"}>}Product),Product)

View solution in original post

9 Replies
Anil_Babu_Samineni

What is the definition of that variable? 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda

This will depend on the definition of what you have calculated in variable $(vTimePeriod)

Suppose you have calculated "max(Year)" in that variable, which gives value as "2019" then you can use this variable to filter any dimension in filter pane

for eg. you can use variable to filter product dimension like below

= aggr(only({<Year = {"$(vTimePeriod)"}>}Product),Product)

sanchi21491
Contributor II
Contributor II
Author

Thanks a lot! It solved my issue! Grateful

sanchi21491
Contributor II
Contributor II
Author

Hi Kush,

I'm using Qlik Variable Extension in my application and used the above expression in the filter pane for dimensions. However, I am not able to select multiple values at a time. 

Is there a solution for this scenario?

Thanks! 

 

 

abhirup99
Contributor III
Contributor III

Hi Kush,

We can't select multiple countries in the filter pane when using the aggr function?Is there any solution to tackle such problems? Your solutions will be highly appreciated

I am illustrating the situation below

When I try open the '"Country" filter first time, though it shows multiple values. But it allows only one selection.

It allows multiple selection that too from the filter navigation at the top and after I have done my initial selection of one value from the filter pane.

Test img_2.JPG

 
 
 

 

 

 

 

 

 


But when I select IND, it doesn't allow multiple selection provision thereafter.

 

Test img.JPG

 

 

 

 

Also attaching the qvf for reference.

kalyanamharish
Contributor III
Contributor III

My observation is we can select multiple values by selecting any one value in the list and dragging down however, we are unable to use the SHIFT key to select the random values.

Kushal_Chawda

Use it like below

aggr(only({1<Year = {"$(vTimePeriod)"}>}Product),Product)

kalyanamharish
Contributor III
Contributor III

Hi @Kushal_Chawda 

Why $ is not working in the place of 1 ?

I mean i was thinking by keeping $ (Set identifier ) in front of Year would allow me to Select multiple Years from the Dimension Filter pane.

 
As per understanding $ should respect the current selection i.e value of expression changes based on the current selection made in UI and 1 will not change the value of that particular expression even if we make any selection in the UI

Kushal_Chawda

if you use $, aggr expression evaluates the associated value and removes the excluded values from filter. But if you use 1 then aggr function works as normal filter. So identifier '1'  does the trick here in filter pane