qlikviewqliksense

How do I make a filter pane appear as a Drop down menu in Qlik Sense?


I am a beginner using Qlik Sense Desktop to make a panel which (ideally) should be as similar as possible to another panel. The panel I am trying to mimic has an option of what I believe to be a filter pane presented as a drop down menu. The figure below (the texts are in Portuguese) shows what I am trying to mimic, and was taken from here, after you click in "Visão Geral":

filter drop down

I know I have the option of creating a filter pane one tile high. This way, the field name would be displayed and when the user click it the values will be shown. However, if possible, I would like something closer to what was shown in the Figure. I tried installing Vizlib library as suggested in this post, but the filter style remains the same.

How can I make a filter pane appear as a Drop down menu in Qlik Sense? Thanks in advance.


Solution

  • You can use a combination of the Variable Input object, a variable, the Concat() function, and Set Analysis to achieve this.

    The basic idea is that the Variable Input object will be in Dropdown mode with a list of all the available values of the [Setor] field, the selection of which will update our variable, which will be expanded in a set expression in each chart measure that we want to affect with this dropdown.

    Step 1: Create a new variable called vDropdown and set the default value to Todos.

    Screenshot of the Qlik Sense variable dialog screen

    Step 2: Add a new Variable Input object to your sheet.

    Under the Variable tab, choose our new variable from the list, then select the Dropdown option.

    Under the Values tab, choose the Dynamic option. In the box below it, add this expression:

    ='*~Todos|' & Concat(all distinct [Setor] & '~' & [Setor], '|')
    

    Here's what this is doing:

    Step 3: Add the set expression to the chart measures that you want to be affected by the dropdown.

    Use this expression:

    {<[Setor]={"$(=Coalesce(EmptyIsNull('$(vDropdown)'), '*'))"}>}
    

    So you would use it like this:

    =Sum({<[Setor]={"$(=Coalesce(EmptyIsNull('$(vDropdown)'), '*'))"}>} [Processos])
    

    Here we are using our vDropdown variable inside of a set expression. Basically what it's doing is to set the [Setor] field to whatever is selected in our dropdown unless our variable is NULL, in which case it just returns an asterisk *. This works for us because when you use an asterisk in set analysis (like this --> "*") then you're basically telling Qlik to return "all non-NULL values."

    That should be enough to make it work:

    GIF of screengrab of Qlik Sense dashboard with Variable Input object as a single-value selector