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
Invesco
Helper V
Helper V

Time Difference in Power Query

Hi Experts

 

How would you calculate the difference in meeting start time and meeting end time in Power Query. 

Sample Data

 

Start TimeEnd Time
11:30:00 13:00:00
16:30:00 15:00:00
09:15:00 10:30:00
1 ACCEPTED SOLUTION

@Invesco 
Add a new column like this:

 

let
Difference = [End Time] - [Start Time],
Day = Number.Abs(Duration.Days(Difference)),
Hour =  Number.Abs(Duration.Hours(Difference)),
Minute =  Number.Abs(Duration.Minutes(Difference)),
Second =  Number.Abs(Duration.Seconds(Difference)),
FullDurationAbs = #duration(Day, Hour, Minute, Second),
NextDayDuration = #duration(0,24,0,0) - FullDurationAbs

in
if [Start Time] > [End Time] then NextDayDuration  else Difference

vojtechsima_0-1653901486402.png

 

 

View solution in original post

5 REPLIES 5
vojtechsima
Resident Rockstar
Resident Rockstar

Hi, @Invesco 
simply like this:

vojtechsima_0-1653897217879.png

 

Hi - thats what i did but i get negitive time...

@Invesco 
Because Start Time is bigger than End Time, do you want me to recreate and check if the Start Time is bigger, it takes the time to another day? so it would 22,5 hours?

yes please

@Invesco 
Add a new column like this:

 

let
Difference = [End Time] - [Start Time],
Day = Number.Abs(Duration.Days(Difference)),
Hour =  Number.Abs(Duration.Hours(Difference)),
Minute =  Number.Abs(Duration.Minutes(Difference)),
Second =  Number.Abs(Duration.Seconds(Difference)),
FullDurationAbs = #duration(Day, Hour, Minute, Second),
NextDayDuration = #duration(0,24,0,0) - FullDurationAbs

in
if [Start Time] > [End Time] then NextDayDuration  else Difference

vojtechsima_0-1653901486402.png

 

 

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!

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.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.