Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
stascher
Partner - Creator III
Partner - Creator III

Finding column value associated with minimum value in another column

Hello,

This should be fairly easy.  Given the following table:

SubjectVisit DateVisit Reason

Arty

1/1/2001Alpha
Arty2/2/2002Beta
Arty3/3/2003Delta
Betty1/15/2015
Betty2/16/2016Biff

I want to create a Table Listing of Subjects with the date of their first visit and, if provided, the visit reason concatenated to the date. Ex:

Header 1Header 2
Arty1/1/2001 - Alpha
Betty1/15/2015

I've got my Table Listing defined with Subject as Dimension #1, and I can define min([Visit Date]) to get the first visit, but I'm not sure of the rest of the expression I need to get the Visit Reason associated with that date.

Thanks for any help.

Steve

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this

Dimension

Subject

Expression

Date(Max([Visit Date])) & ' - ' & FirstSortedValue([Visit Reason], [Visit Date])

View solution in original post

2 Replies
sunny_talwar
MVP
MVP

Try this

Dimension

Subject

Expression

Date(Max([Visit Date])) & ' - ' & FirstSortedValue([Visit Reason], [Visit Date])

stascher
Partner - Creator III
Partner - Creator III
Author

Once again, Sunny to the rescue!

I'd never heard of the FirstSortedValue function before, so I learned something new today.

Thank you very much!