Qlik Community

New to Qlik Sense

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

Tell us which business and trade publications you read most regularly: RESPOND NOW
Showing results for 
Search instead for 
Did you mean: 
Creator II
Creator II

Using variables to show/hide objects

I have a sheet set up so that I have 3 buttons that in relation to a company's department. 

Each department has their very own 2-3 reports they generate. So upon a user clicking any of those 3 buttons, they should see their respective reports. 

Buttons --- (at top of sheet):      MARKETING   |     ACCOUNTING   |    IT

I have it set up this way for now. I'm using a variable called vShow to show a table with 2 columns (for simplicity). 

Set analysis on table:

if($(vShow) = 1, Sum({<Service = {'MARKETING   '}>} [REV]),

if($(vShow) = 2, Sum({<Service = {'ACCOUNTING   '}>} [REV]),

if($(vShow) = 3, Sum({<Service = {'IT'}>} [REV])

Now this does give me what I want, each time I press a button it will only give me data for that department. 

The issue - If I select the "MARKETING" button, it'll give me the table with MARKETING revenue information. The issue is that I also see ACCOUNTING and IT as part of the table although I thought I excluded it in my set analysis by using the variable definition. It also shows 0 as data points for the other 2 departments. Is there a way to completely leave out data points for the other 2. It can be confusing for an end user to click MARKETING and also see the other departments with null data points. 


Labels (3)
3 Replies
Specialist II
Specialist II

You don't need variable buttons and set analysis to do this; this is standard Qlik filtering functionality.
Add a filter bar with Service; it will list your three options. Upon selection the data will filter to just that Service.
Creator II
Creator II

I understand what you’re saying. This is more of an aesthetic feature I’m trying to implement and help users navigate to their granular report based on a push of button with the lowest amount of mouse clicks. 

Luminary Alumni
Luminary Alumni

Hi @124psu ,

Rather than set analysis you might just try calculating the dimension, something like this:

=if(vDept = 'A', 'A', if(vDept = 'B', 'B'))

Then to make it all tidier, make sure you exclude null values from your dimension and set your measure "show column if" property to something like: len(vDept) > 0
That will mean the table is blank until the user selects a variable value which will be a bit neater. (note, I've assumed that you've defined the variable without a default value).

Maybe an even neater and simpler way to achieve the same thing would be just to have a normal selection list of departments and then use the "show column if" property of your measure to only display when GetPossibleCount(department) = 1.