Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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')