Forum Discussion
Anonymous
3 years agoNot applicable
Return Previous Date
Hello, I know there is documentation out there, but maybe there’s a better answer. I want to return the previous date of and ID. I have a PatientID, Admit Date. I want to create a new column called...
AilleryO
3 years agoMemorable Member
Hi,
You can add an index column using Power Query, to have a unique ID for your lines.
And then you can try :
Last Admi Date =
VAR CurrPatient = SELECTEDVALUE( TabPatient[Patient ID] )//Store ID you work with
VAR CurrIndex = CALCULATE( MAX( TabPatient[Index] ) , TabPatient[Patient ID] = CurrPatient )//Store the last index for last date of patient
RETURN
CALCULATE ( MIN ( TabPatient[Admi Date] ) , //Check the MIN date
CurrPatient = TabPatient[Patient ID] , //for that patient
CurrIndex<>TabPatient[Index] ) //not being the date of this line index
It should give you this :
Let us know
- Anonymous3 years agoNot applicable
Can we derrive this in Power Query?
- AilleryO3 years agoMemorable Member
Hi,
Certainly yes, maybe using LastN function or else, but I must confess I do not have a solution ready made for you.
This might guide you :
https://radacad.com/grouping-in-power-query-getting-the-last-item-in-each-group
Let us know if you found your solution