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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Change minutes to hours

Hi, what I want to do is add a colum wich gets me the amount of hours and minutes from and integer value. I have the integer value column.

say I have 100, so it would be 1:40 (hh:mm) or 2880 would be 48:00, NOT two days.

Any help would be great, thanks

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

If you want to do it by custom column in query editor, you can use the following codes:

Number.ToText(Number.IntegerDivide([Column1],60))&":"&Text.PadStart(Number.ToText([Column1]-Number.IntegerDivide([Column1],60)*60),2,"0")

2-1.PNG

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

5 REPLIES 5
jdbuchanan71
Super User
Super User

Hello @Anonymous 

This should work for you.

Hours Minutes = 
VAR Hours = INT ( DIVIDE ('Table'[Minutes], 60 ) )
VAR Minutes = FORMAT ( 'Table'[Minutes] - Hours * 60, "00" )
RETURN Hours & ":" & Minutes
Anonymous
Not applicable

How do I  implement this as a Custom Column?

Hi @Anonymous ,

 

If you want to do it by custom column in query editor, you can use the following codes:

Number.ToText(Number.IntegerDivide([Column1],60))&":"&Text.PadStart(Number.ToText([Column1]-Number.IntegerDivide([Column1],60)*60),2,"0")

2-1.PNG

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

If you go to your table, under modeling you can add a new column then paste in the DAX.  You just need to change the name of the table to be your table name.

Greg_Deckler
Super User
Super User

Wrote an article on this long time ago with @konstantinoshttps://community.powerbi.com/t5/Community-Blog/Aggregating-Duration-Time/ba-p/22486

 

I think there is also something in the Quick Measures Gallery for this.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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