Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 surgery | first time surgery per ID? |
1 | 01-01-2021 | 01-12-2020 | yes |
2 | 02-01-2021 | 02-12-2020 | yes |
3 | 03-01-2021 | 03-12-2020 | yes |
4 | 04-01-2021 | 04-12-2020 | yes |
5 | 05-01-2021 | 05-12-2020 | yes |
5 | 05-01-2021 | 06-12-2020 | No |
5 | 05-01-2021 | 07-12-2020 | No |
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')
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')