Skip to main content

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 
Search instead for 
Did you mean: 
aschmeelk
Contributor III
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
MayilVahanan

Hi @aschmeelk 

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.

View solution in original post

4 Replies
MayilVahanan

Hi @aschmeelk 

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.
aschmeelk
Contributor III
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?

MayilVahanan

Hi @aschmeelk 

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.
aschmeelk
Contributor III
Contributor III
Author

Ah! thank you.