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.
Hi Experts,
I need assistance with calculating the wait time for outpatients in Power BI.
My dataset consists of two tables:
Appointment: Contains details about scheduled appointments, including the appointment time.
OutpatientVisit: Captures information on outpatient visits, including timestamps for 'Checked In' and 'Consult Start' statuses.
Requirement:
I need to calculate the wait time for outpatients based on the following logic:
Wait Time =
IF (
OutpatientVisit.VisitTime (VisitStatus = 'Checked In') < Appointment.AppointmentTime,
OutpatientVisit.VisitTime (VisitStatus = 'Consult Start') - Appointment.AppointmentTime,
OutpatientVisit.VisitTime (VisitStatus = 'Consult Start') - OutpatientVisit.VisitTime (VisitStatus = 'Checked In')
)
I achieved this by creating a calculated column in the OutpatientVisit table, named WaitTime_1.
However, I need to update the DAX formula to handle cases where an outpatient ID is not found in the Appointment table. In such cases, I want to calculate the wait time as:
OutpatientVisit.VisitTime (VisitStatus = 'Consult Start') - OutpatientVisit.VisitTime (VisitStatus = 'Checked In')
How can I achieve this in Power BI using DAX? I am open to using either a calculated column.
Attached is the PBIX file.
Waittime.pbix
Thank you for your help!
Solved! Go to Solution.
Hello @puru85 ,
You can use this measure to accomedate the additional condition you need.
Hello @puru85 ,
I believe if you need the desired result you can try this out as a calculated column.
@Moetazzahran Thank you very much.
It works perfectly in measure, but not as calculated column. When tried in calculated column, the results are not expected. Please help!!
Hello @puru85 ,
I believe if you need the desired result you can try this out as a calculated column.
Hello @puru85 ,
You can use this measure to accomedate the additional condition you need.
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
8 | |
7 |