Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the latest value of a particular field.

Hi,

How to get the latest value of a particular field. Is there a function which can give me the latest value of a filed.

Thanks & Regards,

Rohit

2 Replies
martin59
Specialist II
Specialist II

Hi,

You can do this with firstsortedvalue() function :

<h4>firstsortedvalue ( [{set_expression}] [ distinct ] [ total [<fld {, fld}>] ]expression)</h4>
returns the first value of expression sorted by corresponding sort-weight when expression is iterated over the chart dimension(s). Sort-weight should return a numeric value where the lowest value will render the corresponding value of expression to be sorted first. By preceding the sort-value expression with a minus sign, the function will return the last value instead. If more than one value of expression share the same lowest sort-order, the function will return null. By stating an n larger than 1, you will get the nth value in order.
The function argument expression must not contain aggregation functions, unless these inner aggregations contain the total qualifier. For more advanced nested aggregations, please use the aggr function) in combination with calculated dimensions.
If the word distinct occurs before expression, duplicates resulting from the evaluation of the expression will be disregarded.
If the word total occurs before the function arguments the calculation will be made over all possible values given the current selections but disregarding the chart dimension variables.
The total qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case the calculation will be made disregarding all chart dimension variables except those listed, i.e. one value will be returned for each combination of field values in the listed dimension fields. Also fields which are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the cycle or drill-down level changes. <h2>Examples:</h2>
firstsortedvalue ( PurchasedArticle, OrderDate )
firstsortedvalue ( PurchasedArticle, -OrderDate, 2 )
firstsortedvalue ( A/B, X*Y/3 )
firstsortedvalue ( distinct PurchasedArticle, OrderDate )
firstsortedvalue ( total PurchasedArticle, OrderDate )
firstsortedvalue ( total <Grp> PurchasedArticle, OrderDate )


Martin



Not applicable
Author

HI..

You can use firstsortedvalue() function.

zaman