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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mbrawn
Frequent Visitor

Calculating Duration in Minutes & Seconds between 2 Columns

Hi there,

 

I have 2 columns, both of which are Date/Time (DD/MM/YYYY HH: MM: SS). They are named SessionIDTime and SessionEndTime.

 

These are from a call report table and I need to be able to use a function to determine the minutes and seconds between the Call Start and End times in order to calculate total call times per person.

 

I've seen a number of threads with similar questions, but not one that specifically calculates minutes and seconds. Also, and at the risk of sounding obvious, some calls may be over 1 hour in duration.

 

Thanks,

Matt

 

 

1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

Does DATEDIFF(SessionIDTime, SessionEndTime, second) produce a correct value for the number of seconds of each call? If so that's half the battle, you can then look to get the number of minutes of the call by using something like quotient(newcolumnwejustmade, 60)

 

edit - and the number of seconds similarly except using mod rather than quotient

View solution in original post

3 REPLIES 3
jthomson
Solution Sage
Solution Sage

Does DATEDIFF(SessionIDTime, SessionEndTime, second) produce a correct value for the number of seconds of each call? If so that's half the battle, you can then look to get the number of minutes of the call by using something like quotient(newcolumnwejustmade, 60)

 

edit - and the number of seconds similarly except using mod rather than quotient

Thanks @jthomson - apparently not as some of the calls, somehow, have a start date greater than the end date...

@mbrawn,

 

Just use IF Function to find those rows.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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