Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
josecarmo
Contributor II
Contributor II

Pick the value of highest date transation file

To use on a function KPI chart or a Table , how do I pick the last  date record field "Onhand" field for a product and not the SUM of the transactions.

Take this example bellow I would like to show for produt 001 the Onhand 3200 value once is the record with highest date.

DailyStocks:

Load Stock As Date, Product, Onhand;

LOAD * inline [

Date|Product|Onhand

04/01/2021|001|20000

04/01/2021|002|30000

05/01/2021|001|35000

05/01/2021|002|30000

06/01/2021|001|32000

06/01/2021|002|26000

 ] (delimiter is '|');

2 Solutions

Accepted Solutions
GaryGiles
Specialist
Specialist

Use the FirstSortedValue function.  If you have Product as a dimension in your table object,

=FirstSortedValue(Onhand,-Date)

should give you the latest Onhand value for each Product.

View solution in original post

lironbaram
Partner - Master III
Partner - Master III

hi ,
assuming you use a table with the product as dimension
you can use this expression 
firstsortedvalue(Onhand,-Date)

View solution in original post

4 Replies
GaryGiles
Specialist
Specialist

Use the FirstSortedValue function.  If you have Product as a dimension in your table object,

=FirstSortedValue(Onhand,-Date)

should give you the latest Onhand value for each Product.

lironbaram
Partner - Master III
Partner - Master III

hi ,
assuming you use a table with the product as dimension
you can use this expression 
firstsortedvalue(Onhand,-Date)

josecarmo
Contributor II
Contributor II
Author

Thanks Gary it works fine!

josecarmo
Contributor II
Contributor II
Author

Thanks Lironbaram it work fine!