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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Qliksense_77
Creator
Creator

Find the first date

Hi

I have a dataset from a hospital. Similar to below (except red column). I want to know if a row in the dataset is the first time a specific ID has had surgery.

Therefore I am trying to find the expression for the red dimension?

Id

date of admission

date of surgeryfirst time surgery per ID?
101-01-202101-12-2020yes
202-01-202102-12-2020yes
303-01-202103-12-2020yes
404-01-202104-12-2020yes
505-01-202105-12-2020yes
505-01-202106-12-2020No
505-01-202107-12-2020No
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

You need to use the aggr() and FirstSortedValue functions, like this:

=if([date of surgery]=aggr(FirstSortedValue([date of surgery],[date of surgery]),Id),'Yes','No')

View solution in original post

1 Reply
GaryGiles
Specialist
Specialist

You need to use the aggr() and FirstSortedValue functions, like this:

=if([date of surgery]=aggr(FirstSortedValue([date of surgery],[date of surgery]),Id),'Yes','No')