Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Good Morning,
I am struggling with a problem regarding admission events occurring between weight measurements in a row making that row invalid. I want a way to identify those rows or remove those rows.
I have 2 Tables
Table 1
PatientID | EventDate |
1234 | 01/01/01 |
2345 | 01/03/04 |
1234 | 05/02/01 |
7890 | 02/15/02 |
and
Table 2
PatientID | MeasurementDate | PriorMeasurementDate |
1234 | 12/12/01 | 09/12/01 |
1234 | 07/01/01 | 11/01/00 |
7890 | 08/01/01 | 09/01/01 |
I am needing either a column to identify each row that does/does not have any "event date" in between the measurementdate and priormeasurementdate or I need a table returned with only those rows that DO NOT have an event occuring between the MeasurementDate and PriorMeasurementDate.
So for the above, Row 1 for 1234 would be kept, but Row 2 for 1234 would not. The patient would have been readmitted in between those dates making that row invalid.
I have tried a calculated column:
Solved! Go to Solution.
@Allisond , you can measure like
CALCULATE
(max('Events Data'[Event Date]),
FILTER ('Events Data', max('Weights'[PatientID]) = 'Events Data'[patid]
&& 'Events Data'[Event Date] >= max('Weights'[Previous.Measurement Date])
&& 'Events Data'[Event Date] <= max('Weights'[Measurement Date]))
)
Can you share output in table format?
@Allisond , you can measure like
CALCULATE
(max('Events Data'[Event Date]),
FILTER ('Events Data', max('Weights'[PatientID]) = 'Events Data'[patid]
&& 'Events Data'[Event Date] >= max('Weights'[Previous.Measurement Date])
&& 'Events Data'[Event Date] <= max('Weights'[Measurement Date]))
)
Can you share output in table format?
Thank you!!! It seems to work beautifully.
Just to make sure, using this formula, If I have multiple event dates and multiple wt measure windows will using "MAX" only pull the most recent event or the MAX event date occurring within the dates window? With my understanding of MAX - which may be off for sure...... MAX would only pull the most recent date?
Event: 1/4/20 1/20/20
Wt: 1/6/20 1/18/20
Prior Wt: 1/1/20 1/22/20
Both rows would need to pull the respective event dates that fall within the window of wt to prior wt.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
33 | |
16 | |
13 | |
10 | |
8 |
User | Count |
---|---|
59 | |
20 | |
12 | |
11 | |
10 |