Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
crichter14
Creator
Creator

How to Get a Dynamic Label for a Calculated KPI

Hello there,

Though a lot of reading I've gotten my KPI box to work...yay!  However,  I am wondering how to make the related label dynamic? 

Example, I know that the Max QTY is 10, but in the KPI I want to show the label related to that KPI (i.e. Jan) in addition to the QTY.

How can I make that work?  Sorry if it's a basic question - I'm really struggling on this one.  I stole this table from another thread, but I don't want the quantity - I want the month.

 

MONTHPRODUCTQTY
Jan1234567810
Feb12345678-5
Mar12345678-10
April123456785

 

A simplified example of my code.  I want the "CATEGORY" field related to the Maximum field value.

MAX(AGGR(Sum({$<
[SET_ANALYSIS_1]={"Example"}>}
SALES_AMOUNT)
/
Sum({$<
[SET_ANALYSIS_2]={"Example"}>}
SALES_AMOUNT_2)
,CATEGORY))

 

Ideas?

1 Solution

Accepted Solutions
raji6763
Creator II
Creator II

hi,

you can achieve using FirstSortedValue function.

FirstSortedValue(MONTH,-Aggr(Max(QTY),MONTH))

you can modify according to your example

 

 

regards,

raji

View solution in original post

2 Replies
raji6763
Creator II
Creator II

hi,

you can achieve using FirstSortedValue function.

FirstSortedValue(MONTH,-Aggr(Max(QTY),MONTH))

you can modify according to your example

 

 

regards,

raji

crichter14
Creator
Creator
Author

Thank you Raj,

This works for my question.  

Then I had to amend the code to get the smallest value as well (second request from user).  Removing the minus sign in front of AGGR to gives that.  I had to use the RANK function to eliminate the nulls, but it works.  Thank you Raj!