Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
25 | |
17 | |
12 | |
12 | |
10 |
User | Count |
---|---|
33 | |
27 | |
16 | |
14 | |
13 |