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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SBC
Helper III
Helper III

calculate Turn-around-time based on two column values

Hi 

How to calculate the duration of date and time in one column in power bi. 

example:

base on indate and outdate column, duration column  need to  be calculated.

SBC_0-1663311669699.png

 

 

Thanks,

SBC

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

You can easily do this in Power Query, which is the most suitable for this kind of task. Create a custom columns and insert the following formula:

 

 

Duration.TotalMinutes([InDat]-[outDate])

 


EDIT: You can then use this other formula to obtain the hours format:

 

=Number.From([Duration_Column])*24

 

Since you asked for this in DAX, I feel like I should also point out how to help you with DAX. Power Query remains the best tool, but in case here is what you can use with DAX:

DATEDIFF ( Table[inDat], Table[outDate], SECOND )

 

This will give you the duration in seconds, you can pick other parameters as you prefer, of course.

View solution in original post

tamerj1
Super User
Super User

Hi @SBC 
Please refer to attached sample file with the solution 

1.png

Duration = 
VAR Period = DATEDIFF ( 'Table'[InDate], 'Table'[OutDate], SECOND )
VAR Days = QUOTIENT ( Period, 86400 )
VAR Hours = QUOTIENT ( Period, 3600 ) - Days * 24
VAR Minutes = QUOTIENT ( Period, 60 ) - Days * 1440 - Hours * 60
VAR Seconds = Period - Days * 86400 - Hours * 3600 - Minutes * 60
RETURN
    Days & " days : " & Hours & " hrs : " & Minutes & " mins : " & Seconds & " secs"

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @SBC 
Please refer to attached sample file with the solution 

1.png

Duration = 
VAR Period = DATEDIFF ( 'Table'[InDate], 'Table'[OutDate], SECOND )
VAR Days = QUOTIENT ( Period, 86400 )
VAR Hours = QUOTIENT ( Period, 3600 ) - Days * 24
VAR Minutes = QUOTIENT ( Period, 60 ) - Days * 1440 - Hours * 60
VAR Seconds = Period - Days * 86400 - Hours * 3600 - Minutes * 60
RETURN
    Days & " days : " & Hours & " hrs : " & Minutes & " mins : " & Seconds & " secs"
Anonymous
Not applicable

You can easily do this in Power Query, which is the most suitable for this kind of task. Create a custom columns and insert the following formula:

 

 

Duration.TotalMinutes([InDat]-[outDate])

 


EDIT: You can then use this other formula to obtain the hours format:

 

=Number.From([Duration_Column])*24

 

Since you asked for this in DAX, I feel like I should also point out how to help you with DAX. Power Query remains the best tool, but in case here is what you can use with DAX:

DATEDIFF ( Table[inDat], Table[outDate], SECOND )

 

This will give you the duration in seconds, you can pick other parameters as you prefer, of course.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.