Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

anson_kong
New 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
Valued Contributor

Re: Qlik Sense KPI second expression

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


7 Replies
Not applicable

Re: Qlik Sense KPI second expression

Please share sample data.

Thanks

Neha

agigliotti
Honored Contributor II

Re: Qlik Sense KPI second expression

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

omarbensalem
Esteemed Contributor

Re: Qlik Sense KPI second expression

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
Honored Contributor II

Re: Qlik Sense KPI second expression

maybe this:

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

anson_kong
New Contributor II

Re: Qlik Sense KPI second expression

Thank you Omar , for adding the explanation.

brunobertels
Valued Contributor

Re: Qlik Sense KPI second expression

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
New Contributor II

Re: Qlik Sense KPI second expression

Thank you Bruno,

it works.

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