Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Aag
Contributor III
Contributor III

Question on using measures as filters

Hello all,

My KPI dashboard has around 10 measures most of them are calculated Master item measures. Example metrics: Gross Sales, Net Sales, TSales, FSales, PartSales etc.

I have dimensions like date, AreaManager, SalesManager and Salesperson

I need a dropdown/option to choose which metric user wants to view for the hierarchies and see their ranking based on the metric selected. 

Can you please let me know how I can achieve this? Your inputs will be appreciated. 

Labels (1)
1 Solution

Accepted Solutions
rubenmarin

Hi @Aag, you can use the variable object of the dashboard bundle to create the different options and associate each to a number value.

rubenmarin_0-1611658631126.png

And use this value to select wich measure to show, this can be done in different ways: you can have a table and use "show if" condition to show/hide expressions.

Or if it's in a KPI or similiar you can use Pick() function to select the expression, but you have to copy the expression, in this case you can't use the master measures, it will be something like:

Pick($(varMeasure), [ExpressionFor1], Expressionfor2+...)

varMeasure is the variable used to configure the variable object

View solution in original post

4 Replies
PradeepK
Creator II
Creator II

There can be multiple ways of achieving this.. below is one example.. using Island Table and Variable

1. Create measure Island Table for Filter

Measures:
Load * inline [
Measure
Gross Sales
Net Sales
TSales
FSales
FSales
PartSales
];

 

2. Create vMeasure variable to track what is currently selected

vMeasure : if( GetSelectedCount(Measure)=1 , Measure , 'Net Sales')

// Here 'Net Sales' is default value if nothing or more than one item is selected

// Note : You can Avoid this step completely by marking Measure field as 'Always one selected'

 

3. Use vMeasure in calculation

if($(vMeasure) = 'Net Sales', Sum(data))

// You can also use INT ids in Island table to avoid String comparison. 

// if you have gone with single field select; directly use Measure field in comparison condition

 

I hope this answers your question. 😄

rubenmarin

Hi @Aag, you can use the variable object of the dashboard bundle to create the different options and associate each to a number value.

rubenmarin_0-1611658631126.png

And use this value to select wich measure to show, this can be done in different ways: you can have a table and use "show if" condition to show/hide expressions.

Or if it's in a KPI or similiar you can use Pick() function to select the expression, but you have to copy the expression, in this case you can't use the master measures, it will be something like:

Pick($(varMeasure), [ExpressionFor1], Expressionfor2+...)

varMeasure is the variable used to configure the variable object

PradeepK
Creator II
Creator II

There can be multiple ways of achieving this.. below is one example.. using Island Table and Variable

  • Create measure Island Table for Filter.. i.e Create Inline load for below data

Measure
Gross Sales
Net Sales
TSales
FSales
FSales
PartSales

... So on

  • Create vMeasure variable to track what is currently selected

vMeasure : if( GetSelectedCount(Measure)=1 , Measure , 'Net Sales')

// Here 'Net Sales' is default value if nothing or more than one item is selected

// Note : You can Avoid this step completely by marking Measure field as 'Always one selected'

  • Use vMeasure in calculation

if($(vMeasure) = 'Net Sales', Sum(data))

// You can also use INT ids in Island table to avoid String comparison. 

// if you have gone with single field select; directly use Measure field in comparison condition

I hope this answers your question. ‌‌

PradeepK
Creator II
Creator II

There can be multiple ways of achieving this.. below is one example.. using Island Table and Variable

Create measure Island Table for Filter

Measure
Gross Sales
Net Sales
TSales
FSales
FSales
PartSales


Create vMeasure variable to track what is currently selected

vMeasure : if( GetSelectedCount(Measure)=1 , Measure , 'Net Sales')

// Here 'Net Sales' is default value if nothing or more than one item is selected

// Note : You can Avoid this step completely by marking Measure field as 'Always one selected'

Use vMeasure in calculation

if($(vMeasure) = 'Net Sales', Sum(data))

// You can also use INT ids in Island table to avoid String comparison. 

// if you have gone with single field select; directly use Measure field in comparison condition


I hope this answers your question. ‌‌