Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
mpalha
Contributor III
Contributor III

Dynamically Change Chart Measure

Hello,

I have a set of 4 charts with different dimensions (ex. Category, Department, Brand, Product). I'd like to have the ability for the user to select which metric they would like to see in the 4 charts with the given dimensions. Ideally a dropdown allowing them to select 'Sales' would show these dimensions over the measure 'Sales'. Same thing for Units and other measures. How do I go about doing this?

I have tried creating a variable and if a variable value is selected, the measure would change. However, some measures have different formats. Sales is in dollars and Units is quantity and I don't how to dynamically change the format as well.

I'd like to avoid using alternate measures as its a bit of work for the user to change the measure 4 times.

Any help is appreciated. Thanks!

1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

Create a variable, vMeasure and set the value to the initial Measure that should shown, like

num(sum(Sales),'$#,##0;($#,##0)')

use =$(vMeasure) in the Measure expression for your chart.

Then, add the Variable Input object from the Qlik Dashboard bundle.  Set the variable to vMeasure; Show as Drop down, and use dynamic values.

In the Dynamic Values expression, use:

='num(sum(Sales),''$#,##0;($#,##0)'')~Sales|num(sum(Quantity),''#,##0;(#,##0)'')~Quantity'

You will need to fill in your other measures.  The '' around the number formatting are 2 single quotes, not a double quote.  You need that to get a single quote within a string value.  Each option is seperated by "|".  The "~" separates the actual value from the Label displayed in the drop down.

Hope this helps.

View solution in original post

2 Replies
GaryGiles
Specialist
Specialist

Create a variable, vMeasure and set the value to the initial Measure that should shown, like

num(sum(Sales),'$#,##0;($#,##0)')

use =$(vMeasure) in the Measure expression for your chart.

Then, add the Variable Input object from the Qlik Dashboard bundle.  Set the variable to vMeasure; Show as Drop down, and use dynamic values.

In the Dynamic Values expression, use:

='num(sum(Sales),''$#,##0;($#,##0)'')~Sales|num(sum(Quantity),''#,##0;(#,##0)'')~Quantity'

You will need to fill in your other measures.  The '' around the number formatting are 2 single quotes, not a double quote.  You need that to get a single quote within a string value.  Each option is seperated by "|".  The "~" separates the actual value from the Label displayed in the drop down.

Hope this helps.

mpalha
Contributor III
Contributor III
Author

Thanks @Anonymous ! Works perfectly.