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

Get greater amount from table using set analysis

Hi,

I have a table that look like this:

Date            Amount

01/01/2013   40,000

01/02/2013   50,000

01/04/2014   55,000

01/06/2015   9,000


I need to take greater amount and the date of this amount.


For example: the result in this case would be 55,000 and 01/04/2014


I have tryied to use FirstSortedValue function but it's doesn't word because it return the first or the las value.



King regards!

1 Solution

Accepted Solutions
sunny_talwar

Try this:

='Geater selling day' & Chr(13) & FirstSortedValue(Date, -Aggr(Sum(Amount), Date)) & Chr(13) & Max(Aggr(Sum(Amount), Date))

View solution in original post

11 Replies
sunny_talwar

Is amount a field in your database or is this a expression like this -> Sum(Amount)

May be this in a text box:

Amount -> Max(Aggr(Sum(Amount), Date))

Date -> FirstSortedValue(Date, -Aggr(Sum(Amount), Date))

Not applicable
Author

No.. this example return the last date.

I just typed an example width the result i need. in the example table the last date is 01/06/2015 but i don't want the last date; i just want the date for that amount. example:

Amount: 55,000

Date: 01/04/2014

your result would by:

Amount: 55,000

Date: 01/06/2015 and that's not correct

maxgro
MVP
MVP

maybe also, in a straight table chart,

sorting by sum(Amount) descending

and in presentation tab max number --> 1

maybe also, in a straight table chart

using dimension limit

Not applicable
Author

the problem is tha I'm building the table in memory, so i have an set anlysis using aggr function ordering by date.

this value will be displayed in a textbox object; is for that i want to take the greater amount and his date. the textbox will say:

Greater selling day

     01/04/2014

      55,000

I'm looking for thats.

sunny_talwar

Have you looked at what I proposed for text box object?

sunny_talwar

See attached:

Capture.PNG

Not applicable
Author

I've tried your answer but i'm geeting the next error.

Error: Error in expression:

Nested aggregation not allowed

I'm using this expression:

='Greater selling day&Chr(13)&

Concat(FirstSortedValue(Fecha, -Aggr(Sum(Amount), Fecha)))

&Chr(13)& Num(vMaximoCobrado,'#,###.##')

vMaximoCobrado is a variable i have containing the greater amount.

sunny_talwar

Why are using Concat() function here? Can you elaborate?

Not applicable
Author

the concat function is for concat the Date to text Greater selling day and the amount.