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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Convert Number into hours and minutes

Hello Power Bi super solvers,

 

Could you help me get over the hill by converting a number into hours?

 

Background: My data has a field - 30-minute session. The row has 0, 1, 2, 3, etc. Each number represents a 30-minute session. For example, 4 means four sessions at 30 minutes each. Therefore, it should equal two hours.

 

Could you nudge me in the right direction to show the output as E.G. 11:30, 24:00, etc.?

 

Any resource is greatly appreciated.

 

Thank you

 

Luis

 

Sample Tables

Student NameStudent IDTutorSessions Week30-minute SessionsSessions Weeks (Groups)
Luna Jeremiah82272Binder, Judy2-1 Sessions11First Six Weeks
Luna Jeremiah82272Binder, Judy3-1 Sessions8Second Six Weeks
Luna Jeremiah82272Binder, Judy3-3 Sessions2Third Six Weeks
Monarrez, Kamila46278Binder, Judy1-412First Six Weeks
Monarrez, Kamila46278Binder, Judy2-412Second Six Weeks
Monarrez, Kamila46278Binder, Judy3-44Third Six Weeks

 

Envisioned Output

 

Student NameStudent IDFirst Six WeeksSecond Six WeeksThird Six WeeksTotal Hours (HH: MM)
Monarrez, Kamila4627806:0006:0002:0014:00
Luna Jeremiah8227205:3004:0001:0010:30

 

 

Could someone point me in the correct direction?

 

Thank you.

2 ACCEPTED SOLUTIONS
andhiii079845
Solution Sage
Solution Sage

What happend if you have more than 24h (48 sessions x 30 min)?

 

Column =
var _min = 'Table (2)'[Column1]*30
var hourNo=INT(_min/60)
var minuteNO=MOD(_min,60)
RETURN  FORMAT(hourNo,"#00")&":"&FORMAT(minuteNO,"#00")
 
Bildschirmfoto 2023-03-05 um 21.43.50.png

You can also change to data type time with the column.





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

Proud to be a Super User!




View solution in original post

Try this. It is great that you want to understand the synthax! 🙂

Tutoring in HH:MM =
VAR _Min = [Total Tutoring Hours]*30
VAR HourNo = INT(_Min/60)
VAR minuteNo = MOD(_Min, 60)
Return
FORMAT(HourNo, "#00") & ":" & FORMAT(minuteNo, "#00")
 




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

Proud to be a Super User!




View solution in original post

11 REPLIES 11
Anonymous
Not applicable

@andhiii079845 

 

Apologies for the delayed response.

 

Total Tutoring Hours = SUM(Separate[Tutoring Time (30 Minutes each session)])

 

Tutoring in HH:MM =
VAR _Min = [Total Tutoring Hours]*30
VAR HourNo = INT(_Min/60)
VAR minuteNo = MOD(_Min, 60)
Return FORMAT(HourNo, "#00") & ":" & FORMAT(minuteNo, "#00")
 
Is that the information you were asking for me to provide?
Anonymous
Not applicable

@andhiii079845 - Thank you.

 

It worked exactly as expected.

 

Appreciate your willingness to share your expertise.

andhiii079845
Solution Sage
Solution Sage

What happend if you have more than 24h (48 sessions x 30 min)?

 

Column =
var _min = 'Table (2)'[Column1]*30
var hourNo=INT(_min/60)
var minuteNO=MOD(_min,60)
RETURN  FORMAT(hourNo,"#00")&":"&FORMAT(minuteNO,"#00")
 
Bildschirmfoto 2023-03-05 um 21.43.50.png

You can also change to data type time with the column.





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

Proud to be a Super User!




Anonymous
Not applicable

forgot to add that i am stuck on this  DAX

 

quipmaster_0-1678048967296.png

Tutoring in hours =
Var Total_Hours =
    SUMX(
        'Tutorial Log',
        HOUR('Tutorial Log'[30-minute Sessions] + MINUTE('Tutorial Log'[30-minute Sessions])/60
        )
Return

I see now that you forget something after RETURN. There has to be s calculations or a return of a variable 





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

Proud to be a Super User!




Anonymous
Not applicable

Hi @andhiii079845 - i think i see what you mean.

 

Tutoring in HH:MM =
VAR _Min = [Total Tutoring Hours]*30
VAR HourNo = INT(_Min/60)
VAR minuteNo = MOD(_Min, 60)
Return
HourNo, minuteNo
FORMAT(HourNo, "#00") & ":" & FORMAT(minuteNo, "#00")
 
quipmaster_0-1678372949080.png

 

Could you give me another friendly nudge in correcting the syntax? I believe I want variables HourNo and MinuteNo to be returned in the DAX.

 

Thank you for everything.

Sorry for my late answer. 

Tutoring in HH:MM =
VAR _Min = [Total Tutoring Hours]*30
VAR HourNo = INT(_Min/60)
VAR minuteNo = MOD(_Min, 60)
Return
HourNo, minuteNo
FORMAT(HourNo, "#00") & ":" & FORMAT(minuteNo, "#00")

You can not return 2 values in one column. Like: 60 20. You have to transform it with 
FORMAT(HourNo, "#00") & ":" & FORMAT(minuteNo, "#00") in one value per row. Or you create two columns. One for hours, one for minutes.
If you have futher question, let us know what is your goal, your involved columns/table and your desired result.  One good example can make everything more clear. 🙂




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

Proud to be a Super User!




Anonymous
Not applicable

Hi @andhiii079845,

 

No worries about the timing of the response. I appreciate your follow-up. 

 

I am still learning the syntax, but your response indicates that this syntax is incorrect - per the error message. I have played around with the syntax but can't get it correct.

 

quipmaster_0-1678391885643.png

 

This visual almost does what I want.

The tooltip is great

I want the Y axis to show the number of tutoring hours in HH:MM.

 

Any gentle nudge on my syntax is greatly appreciated. I still can't upload a PBIX. Wish that I could, would make my message and intent clearer.

 

quipmaster_1-1678391946506.png

 

 

 

Try this. It is great that you want to understand the synthax! 🙂

Tutoring in HH:MM =
VAR _Min = [Total Tutoring Hours]*30
VAR HourNo = INT(_Min/60)
VAR minuteNo = MOD(_Min, 60)
Return
FORMAT(HourNo, "#00") & ":" & FORMAT(minuteNo, "#00")
 




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

Proud to be a Super User!




Anonymous
Not applicable

That works! Thank you very much.

 

I know it is limiting to troubleshoot with a PBIX file. Hopefully, I can upload a PBIX file next time I post a problem.

Can you share please all involved column for your dax expression? 





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

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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