Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Federicofkt
Contributor III
Contributor III

Filter on a KPI in set analysis

Hi!

In my set analysis I have a page with some KPI's showing the selling of specific product like:

Prod A: 15

Prod B: 10

Below, I put a details table with all the products sold, with date, price as well as other info.

 

What I'd like to do is to let the user to click on a KPI, for example the Product A kpi and, by doing so, to filter the rows in the table in order to display only the ones related to product A (so in this case 15 rows).

Is there a way to do so?

 

Thanks

Labels (3)
4 Replies
pedrohenriqueperna
Creator III
Creator III

Hi,

I believe you can't actually filter anything clicking on a KPI object like you can by clicking a dimension in other Qlik's objects, but there're definitely workarounds.

One that first comes to my mind would be using the new layout container to hold the KPI object and a button. You could be satisfied with that or you could hide the button completely, removing background color or setting as the same color as the layout container. You could also stylize it using css, but for that you'd need an extension object that allows you to write and apply css to the dashboard. I particularly use "grouped container object" and "advanced kpi"

 

ce8449f1ed782c1a3617eb5261f7d224.gif

For the example above, I did the following:

 

1. Look for the "layout container" in the Qlik "custom objects" and add it to the sheet

2. Add the KPI object to the layout container

3. Add a button to the layout container

4. Create a variable with whatever name and set it's value to 0

5. Click on the layout container, then click to edit the button properties

6. Under "actions and navigation" create a new action for "set variable value"

7. Set the variable you created in the "Variable" input

8. In the "Value" input add the following: =If(yourVariableName = 0, 1, 0) // this will alternate between 2 values whenever you click the button

9. Now create whatever expression you want by using the variable as a condition:

If(yourVariableName = 0, 'your expression or value', 'your other expression or value')

10. Do the same for titles or wherever you need.

Qrishna
Master
Master

KPI doesn't have action feature as of now like 'button' object. Hopefully it will come soon in upcoming releases. Many extensions like Vizlib provide that but it comes with a cost.

check this: https://community.qlik.com/t5/App-Development/KPI-Object-with-the-action/td-p/2111419

Federicofkt
Contributor III
Contributor III
Author

That's great but I don't have to filter a single kpi, I need to filter a whole table that is at the bottom of the page.

So in the top of the page I have let's say this 5 kpis with the selling amount of 5 different products, in the bottom I have the table with the details for every piece sold.

 

So if the kpi at the top is displaying "Product A: 15 units", I'm expecting that if i press the button, the table will be filtered in the same way as I am filtering "A" on the "Product" dimension column in the table.

If then I'm clicking on button related to Product B, the action should add product B as a filter.

I'm not sure that your instructions accomplish this

pedrohenriqueperna
Creator III
Creator III

It does, actually. It's just a bit more complicated. You'd have to use multiple variables each for a button. In your table you'd have an If to display whatever if a variable/button is pressed or not. It'd work better if you just toggle between the products. If you wish to show multiple products according to the button status, you'd have to create a complicated if checking for multiple variables and combinations.

 

If you check the print I added you can see the table changes the values as you click. It's just a case of complexity. If you want to display multiple selections and have a lot of products, this solution won't be very useful indeed.

 

 

If(vButton1 = 0, x, If(vButton2 = 0, y, If(vButton3 = 0, z.......)))