cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
javargas26 Frequent Visitor
Frequent Visitor

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

Accepted Solutions
Community Support Team
Community Support Team

Re: Change minutes to hours

Hi @javargas26 ,

 

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 more quickly.

View solution in original post

5 REPLIES 5
Super User
Super User

Re: Change minutes to hours

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.


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Super User
Super User

Re: Change minutes to hours

Hello @javargas26 

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
javargas26 Frequent Visitor
Frequent Visitor

Re: Change minutes to hours

How do I  implement this as a Custom Column?

Super User
Super User

Re: Change minutes to hours

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.

Community Support Team
Community Support Team

Re: Change minutes to hours

Hi @javargas26 ,

 

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 more quickly.

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

New Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 238 members 2,296 guests
Please welcome our newest community members: