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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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