Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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!