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

Measure dependent on selected dimension

Hi

I have a bar chart with multiple dimensions, among which a drill down over date and country. When I select country I want the measure to be equal to the last available value among all the dates I have, and when I select the date I want the respective value (so last month of the year if I have the year level, last month of the quarter for the quarter and all values for month).

I'm handling the date dimension like this:

if(GetSelectedCount([Year])=0 or Count(DISTINCT [Year])=0, SUM({<[Month] = {$(=Date(MAX([YearMonth]), 'MMM'))}>}[Monthly KPI]),

if(GetSelectedCount([YearQuarter])=-1 or Count(DISTINCT [YearQuarter])=-1,

SUM({<[YearQuarter] =,  [Month] = {"Mar", "Jun", "Sep", "Dec", $(=Date(MAX([YearMonth]), 'MMM'))}>}[Monthly KPI]),

SUM({<[Month] = >}[Monthly KPI])))

The problem is that I need a different calculation in case of country and other dimensions.

Is there a way to do this in the same measure, avoiding creating two different ones?

2 Replies
Anonymous
Not applicable
Author

That doesn't really solve my problem since at that point I would need to ask users to go in the dashboard, change the selected dimension and the one in the ValueList, at which point they might as well select a new metric.

Is there a more user-friendly solution?