Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
How to convert total duration into hours in power bi?
Ex: 103mins ---> 1hr 43 mins
Solved! Go to Solution.
Hi @Anonymous
Use the following DAX;
Hi @Anonymous
Use the following DAX;
Hi,
If you have a column Col of a table T which gives you a duration in minutes, then you can create a calculated column Col2 with rhe following:
Col2=
Var hours_min =
MOD ( INT ( 'Table'[Col] / 60 / 60 ), 24 )
VAR minutes =
MOD ( INT ( 'Table'[Col] / 60 ), 60 )
RETURN
hours
& " hr "
& minutes
& " mins "
Best regards.
Did I answer your question? Mark my post as a solution!
Hi,
There was a little typo in my answer.
Consider the following, instead:
Hi,
If you have a column Col of a table T which gives you a duration in minutes, then you can create a calculated column Col2 with rhe following:
Col2=
Var hours =
MOD ( INT ( 'Table'[Col] / 60 / 60 ), 24 )
VAR minutes =
MOD ( INT ( 'Table'[Col] / 60 ), 60 )
RETURN
hours
& " hr "
& minutes
& " mins "
Best regards.
Did I answer your question? Mark my post as a solution!
Hi,
I apologize: what I suggested in the two precedent answers was not correct; I was not in front of my Power BI Desktop, in order to test what I wrote.
Here's a solution that I just tested and which works correctly (Col2 is a calculated column, and 'Table'[Col] is your column in minutes)
Col2 =
Var hours =
INT ( 'Table'[Col] / 60 )
VAR minutes =
'Table'[Col] - hours
RETURN
hours
& " hr "
& minutes
& " mins "
Best regards.
Did I answer your question? Mark my post as a solution!
Hi
I am trying to use your solution above. Seems to be something missing in that when theres a number over 60 it registers 1 hour and still gives me the total minutes.
Please see example
My calculated column:
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.