Forum Discussion
yve214
4 years agoHelper III
Urgent Help with Creating a Flag column
Problem: Please, I am trying to check if my recent admission location is the same as my recent discharge location and create a flag to help me with my other measures. How to approach this. check...
- 4 years ago
Hi yve214
please try
Flag = VAR CurrentIDTable = CALCULATETABLE ( Table1, ALLEXCEPT ( Table1, Table1[patient_Id] ) ) VAR LastAdmissionLocation = MAXX ( TOPN ( 1, CurrentIDTable, Table1[admission_date] ), Table1[Location] ) VAR LastDischargeLocation = MAXX ( TOPN ( 1, CurrentIDTable, Table1[discharge_date] ), Table1[Location] ) RETURN IF ( LastAdmissionLocation = LastDischargeLocation, 1 )
tamerj1
4 years agoCommunity Champion
Hi yve214
please try
Flag =
VAR CurrentIDTable =
CALCULATETABLE ( Table1, ALLEXCEPT ( Table1, Table1[patient_Id] ) )
VAR LastAdmissionLocation =
MAXX ( TOPN ( 1, CurrentIDTable, Table1[admission_date] ), Table1[Location] )
VAR LastDischargeLocation =
MAXX ( TOPN ( 1, CurrentIDTable, Table1[discharge_date] ), Table1[Location] )
RETURN
IF ( LastAdmissionLocation = LastDischargeLocation, 1 )