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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Conversion of minutes into hours in power bi

How to convert total duration into hours in power bi?

Ex: 103mins ---> 1hr 43 mins

 

1 ACCEPTED SOLUTION
SanketBhagwat
Solution Sage
Solution Sage

Hi @Anonymous 

Use the following DAX;

Hours =
var hourNo=INT([Minutes]/60)
var minuteNO=MOD([Minutes],60)
return
FORMAT(hourNo,"#00")&":"&FORMAT(minuteNO,"#00")
Let me know if that works.


If this post helps, then mark it as 'Accept as Solution' and give it a thumbs up.

View solution in original post

5 REPLIES 5
SanketBhagwat
Solution Sage
Solution Sage

Hi @Anonymous 

Use the following DAX;

Hours =
var hourNo=INT([Minutes]/60)
var minuteNO=MOD([Minutes],60)
return
FORMAT(hourNo,"#00")&":"&FORMAT(minuteNO,"#00")
Let me know if that works.


If this post helps, then mark it as 'Accept as Solution' and give it a thumbs up.
ManguilibeKAO
Resolver I
Resolver I

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

 

EMSSS22_0-1694009168819.png

 

My calculated column:

 

Col2 =
VAR Hours = INT('vTicketStatasticInfo'[Incident Response]/60)
VAR Minutes = 'vTicketStatasticInfo'[Incident Response] - INT('vTicketStatasticInfo'[Incident Response]/60)
Return
Hours & "hr"
& Minutes & "m"

 

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors