Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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.