# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save \$300 before February 6: REGISTER NOW!
cancel
Showing results for
Did you mean:
Contributor III

## Displaying a Field value in a KPI using set analysis

I have a Table (see attached image) and a KPI (image attached). I want two measures in my KPI, one which displays the calculated Age of the oldest work order in the table and the second to display the work order number of that work order. I read a solution to a similar problem where the solution referred to one column of a table to grab another column in the same row: =Only({<ID={1}>} value).  What I tried is =Only({<Days={'=max(Days)'}>} Work_Order_Number) and that didn't work.

So is this even possible? If so, what am I missing? It seems like my set expression should work, but then I have a lot to learn about Qlik too.

Appreciate any suggestions!

1 Solution

Accepted Solutions
MVP

Try with Firstsortedvalue, something like

=FirstSortedValue(Distinct Work_Order_Number, -Aggr(Only({<ID={1}>} value), Work_Order_Number))

Thanks & Regards,
Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
4 Replies
MVP

Try with Firstsortedvalue, something like

=FirstSortedValue(Distinct Work_Order_Number, -Aggr(Only({<ID={1}>} value), Work_Order_Number))

Thanks & Regards,
Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Contributor III
Author

First, thank you for your response, Mayil!

Regarding the above suggested set expression: =FirstSortedValue(Distinct Work_Order_Number, -Aggr(Only({<ID={1}>} value)Work_Order_Number))

Question:

Is the '-' in front of the Aggr() intentional and if so, what does it signify?

MVP

Please refer the below link for more detail about firstsortedvalue function

https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/Scripting/Aggre...

If you place a minus sign in front of aggr function (Sort_weight), the function returns the highest sorted value.

Thanks & Regards,
Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Contributor III
Author

Ah! thank you.

Tags
Community Browser