Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
anson_kong
Contributor II
Contributor II

Qlik Sense KPI second expression

Dear all,

I would like to create the second expression based on the same set of the data,

the below first expression is about the highest total quantity among the 30 order date (or within period).

say, the highest total quantity is on 21 Aug 2017 in Aug 2017

Max(Aggr(sum({$<item={'ABC'}>}[Quantity]), [Order Date]))

how can I get the 21 Aug 2017 as second expression in KPI?

Thank you so much

1 Solution

Accepted Solutions
brunobertels
Master
Master

Hi

may be this :

firstsortedvalue ( [Order Date] , - Max(Aggr(sum({$<item={'ABC'}>}[Quantity]), [Order Date])) )


in fact this one


firstsortedvalue ( [Order Date] , - (Aggr(sum({$<item={'ABC'}>}[Quantity]), [Order Date]))


Bruno


View solution in original post

7 Replies
Not applicable

Please share sample data.

Thanks

Neha

agigliotti
Partner - Champion
Partner - Champion

I don't understand what's your expected result for the second expression in KPI.

OmarBenSalem

When he uses this expression in the first measure:

Max(Aggr(sum({$<item={'ABC'}>}[Quantity]), [Order Date]))

he gets as a result: 350 for example; and he knows that this is Quantity for the Order Date = 21 aout 2017


So, he wants, in the second measure ; to show 21 Aout 2017 (he can show this as a title for example..)

I'm working on it

agigliotti
Partner - Champion
Partner - Champion

maybe this:

only( Aggr( if( [Order Date] = Max( TOTAL Aggr( sum( { $< item = {'ABC'} >} [Quantity] ), [Order Date] ) ), [Order Date], null() ), [Order Date] ) )

anson_kong
Contributor II
Contributor II
Author

Thank you Omar , for adding the explanation.

brunobertels
Master
Master

Hi

may be this :

firstsortedvalue ( [Order Date] , - Max(Aggr(sum({$<item={'ABC'}>}[Quantity]), [Order Date])) )


in fact this one


firstsortedvalue ( [Order Date] , - (Aggr(sum({$<item={'ABC'}>}[Quantity]), [Order Date]))


Bruno


anson_kong
Contributor II
Contributor II
Author

Thank you Bruno,

it works.

date(firstsortedvalue ( [Order Date] , - (Aggr(sum({$<item={'ABC'}>}[Quantity]), [Order Date]))),'dd-MMM-yyyy')