Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |