Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Thanks,
SBC
Solved! Go to Solution.
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.
Hi @SBC
Please refer to attached sample file with the solution
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"
Hi @SBC
Please refer to attached sample file with the solution
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"
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.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 21 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 19 | |
| 13 | |
| 10 |