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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ranz_vincent
Helper I
Helper I

Getting Time Difference

Hello I need help please. I wanted to get the duration it takes from dispatch and arrival to store and my first problem is dispatch date and dispatch time are on seperate columns same with arrival to store and I cant combine them to a single column and from there my plan was to compute the duration from the 2 combined columns or  if anyone has a better way

ranz_vincent_0-1731551678941.png

 

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @ranz_vincent - You can create new columns to combine the dispatch date with dispatch time and arrival date with arrival time.

 

DispatchDateTime =
'Table'[dispatch_date] + 'Table'[dispatch_time]

 

Combine Arrival Date and Time

ArrivalDateTime =
'Table'[arrival_date] + 'Table'[arrival_time]

 

Once you have the DispatchDateTime and ArrivalDateTime columns, you can calculate the duration between them

Duration =
DATEDIFF('Table'[DispatchDateTime], 'Table'[ArrivalDateTime], MINUTE)

 

This formula calculates the duration in minutes. You can replace MINUTE with SECOND, HOUR, or DAY depending on your preferred unit of time.

 

Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

v-tangjie-msft
Community Support
Community Support

Hi @ranz_vincent ,

 

Thanks rajendraongole1 for the quick reply and solution. In addition to creating calculated columns in Desktop, you can also create new columns in Power query.

(1)Add column->merge column.

vtangjiemsft_0-1731653737208.png

vtangjiemsft_1-1731653794425.png

(2) Change column type.

vtangjiemsft_2-1731653832101.png

(3) Add a custom column.

 

vtangjiemsft_3-1731653952538.png

 

If you need minutes, use it:

Duration.TotalMinutes([arrival]-[dispatch])

vtangjiemsft_5-1731654418263.png

 

vtangjiemsft_6-1731654463076.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

View solution in original post

4 REPLIES 4
ranz_vincent
Helper I
Helper I

Sorry I got side tracked from other tasks but thanks a lot for this i tried both suggestions and they worked great so thanks again.

v-tangjie-msft
Community Support
Community Support

Hi @ranz_vincent ,

 

Thanks rajendraongole1 for the quick reply and solution. In addition to creating calculated columns in Desktop, you can also create new columns in Power query.

(1)Add column->merge column.

vtangjiemsft_0-1731653737208.png

vtangjiemsft_1-1731653794425.png

(2) Change column type.

vtangjiemsft_2-1731653832101.png

(3) Add a custom column.

 

vtangjiemsft_3-1731653952538.png

 

If you need minutes, use it:

Duration.TotalMinutes([arrival]-[dispatch])

vtangjiemsft_5-1731654418263.png

 

vtangjiemsft_6-1731654463076.png

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

 

Sorry I got side tracked from other tasks but thanks a lot for this i tried both suggestions and they worked great so thanks again.

rajendraongole1
Super User
Super User

Hi @ranz_vincent - You can create new columns to combine the dispatch date with dispatch time and arrival date with arrival time.

 

DispatchDateTime =
'Table'[dispatch_date] + 'Table'[dispatch_time]

 

Combine Arrival Date and Time

ArrivalDateTime =
'Table'[arrival_date] + 'Table'[arrival_time]

 

Once you have the DispatchDateTime and ArrivalDateTime columns, you can calculate the duration between them

Duration =
DATEDIFF('Table'[DispatchDateTime], 'Table'[ArrivalDateTime], MINUTE)

 

This formula calculates the duration in minutes. You can replace MINUTE with SECOND, HOUR, or DAY depending on your preferred unit of time.

 

Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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