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: 
dimitrisch
Contributor
Contributor

Returning a value of the max number in a table

I have a table with purchase data.

Now I only want to return the latest purchase price in a pivot table.

I made this function:

If((max(purchasenumber)= purchasenumber),purchase.purchaseprice_netto)

--> purchasenumber is the unique number of the purchasedocuments, so the highest number (max) is the latest document.

I get a "-" as result in my pivot table, when I select the latest purchasedocument in a selection box than it returns the correct value!

What am I doing wrong?

Labels (1)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

Try using FirstSortedValue(), like:

FirstSortedValue(purchase.purchaseprice_netto, -purchasenumber)

View solution in original post

2 Replies
tresesco
MVP
MVP

Try using FirstSortedValue(), like:

FirstSortedValue(purchase.purchaseprice_netto, -purchasenumber)

dimitrisch
Contributor
Contributor
Author

Thx, this gives the correct value!