Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Deaviouspeanut
Regular Visitor

Wait Time Calculation

I'm trying to work out wait times and be able to work out average wait times and Graph

 

I have the table set up with Arrival time and Consultation time see below

Deaviouspeanut_0-1716526985380.png

 

I have created a custom Column called wait time which is consultationtime - Arrivaltime, The results are shown below, there's no issue with the results this column gives me, the issue comes when I try to find min and max or graph, it completely ignores the hours and just graphs the minutes (eg the 2hr 18 min result is just seen as 18 min). this then throws out the wait times and reports incorrectly. 

Deaviouspeanut_1-1716527037451.png

 

I've tried setting up the Wait time column using Datediff, however this formula isn't recognised for some reason, I've tried using time.minute, this just gives me the minutes ignoring the hours, similar if I used time.hour just gives me the hours and ignores the minutes.

 

Happy if it just gave me the reading with just the minutes eg. 1:30 just came back as 90 etc

1 ACCEPTED SOLUTION
halfglassdarkly
Responsive Resident
Responsive Resident

Oh OK, DATEDIFF is a DAX function used in PowerBI. You're trying to add a 'custom column' in PowerQuery not a 'calculated column' in PowerBI itself. The equivalent function to calculate duration in minutes between date/time in PowerQuery would be Duration.TotalMinutes


See the solution proposed here: https://forum.enterprisedna.co/t/return-difference-of-two-dates-in-minutes/15174


Alternatively if your dataset isn't huge then adding this as a calculated column to your table in PowerBI using DATEDIFF is still an option.

 

View solution in original post

6 REPLIES 6
halfglassdarkly
Responsive Resident
Responsive Resident

Oh OK, DATEDIFF is a DAX function used in PowerBI. You're trying to add a 'custom column' in PowerQuery not a 'calculated column' in PowerBI itself. The equivalent function to calculate duration in minutes between date/time in PowerQuery would be Duration.TotalMinutes


See the solution proposed here: https://forum.enterprisedna.co/t/return-difference-of-two-dates-in-minutes/15174


Alternatively if your dataset isn't huge then adding this as a calculated column to your table in PowerBI using DATEDIFF is still an option.

 

Thankyou

the second part of the formulae works.

 

How do you use DAX functions in BI, there's a few functions that I would like to start using but not sure how to input them as DAX

halfglassdarkly
Responsive Resident
Responsive Resident

Oh, that's weird. Are other functions working OK? Ocassionally the intellisense autocomplete prompt might get glitchy and you may need to quit out and reopen. It could just be something contextual if you have other elements in your formula.

 

You're adding this as a calculated column in the same table yes? Not as a measure.

 

Maybe post a screenshot of the formula and any error you're getting.

Yes custom Column

Deaviouspeanut_0-1716529006710.png

Just realised I forgot to start the Square Bracket with the Minutes

When created I get

Deaviouspeanut_2-1716529358856.png

 

 

Then if I replace the formula of the column previously I just get

 

 

halfglassdarkly
Responsive Resident
Responsive Resident

DATEDIFF works with date or date/time but I suspect it requires a date.

 

Try:

= DATEDIFF(TODAY() + [ArrivalTime], TODAY()+[ConsultationTime],MINUTE])

 

You can substitute the actual date instead of TODAY() if you have it, but shouldn't make a difference if arrival and consultation are always the same day.

For some reason my BI doesn't recognise the DATEDIFF function at all

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.