Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Aggr() function

Hi,

I have a straight table with customer ID , date of invoices and store.

i want to use AGGR() function in order to show only one row with the last date of invoice.

Aggr(Max(InvoiceDate),CustomerID)

i guess i need another aggr() in order to get what i want..

anyone?

the table is like this:

ID | date of invoice | store

1 , 1/1/12 , AA

1 , 1/5/12 ,BB

2 , 1/1/13 , AC


i need :

ID | date of invoice | store

1 , 1/5/12 , BB

2 , 1/1/13 , AC


thanks,


1 Solution

Accepted Solutions
sunny_talwar

I think you just need FirstSortedValue() function:

Dimension: ID

Expression1: =Date(Max([date of invoice]))

Expression2: =FirstSortedValue(store, -[date of invoice])


Capture.PNG

View solution in original post

6 Replies
sunny_talwar

I think you just need FirstSortedValue() function:

Dimension: ID

Expression1: =Date(Max([date of invoice]))

Expression2: =FirstSortedValue(store, -[date of invoice])


Capture.PNG

Anonymous
Not applicable
Author

Thanks Sunny!

But if i want to use AGGR - i need it in as dimension.. can i do it?

avinashelite

if you want to use this "Aggr(Max(InvoiceDate),CustomerID)" expression then

CustomerID needs to be in the dimensions list

sunny_talwar

This as your dimension:

=Aggr(FirstSortedValue(store, -[date of invoice]), ID)

Anonymous
Not applicable
Author

Thank you so much!

sunny_talwar

Your welcome