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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

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

@Anonymous 
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

 

 






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

View solution in original post

5 REPLIES 5
vojtechsima
Super User
Super User

Hi, @Anonymous 
simply like this:

vojtechsima_0-1653897217879.png

 






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.
Anonymous
Not applicable

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

@Anonymous 
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?






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.
Anonymous
Not applicable

yes please

@Anonymous 
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

 

 






Any kudos or recognition appreciated. To learn more on the topic, check out my blog and follow me on LinkedIn.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.