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
christianfcbmx
Post Patron
Post Patron

Convert minutes into Hours; Minutes; and Seconds (not days) getting a calculated column able to sum

Hi guys

 

I have an excel file with 2 dates and over PB I could get the result expected (the diff in minutes and then convert into hours, minutes, and seconds)...but that new calculated column can not be switched from text format (the way it is now) to date or time or number or anything to sum, get averages etc. PB doesnt allows it I guess... anyone could help me out!!!!

 

ccccccccccccc.jpg

5 REPLIES 5
christianfcbmx
Post Patron
Post Patron

And this is the formula I used in power BI to get the calculated column:

 

ggggggggggggggg.jpgDuración (7*24) = var hourNo=INT([TotalminutesDiff(7*24)]/60)
var minuteNO=MOD('EXTR-INC&WO-Genérico v4 0 (Chil'[TotalminutesDiff(7*24)],60)
var secondNo=INT(([TotalminutesDiff(7*24)]-INT([TotalminutesDiff(7*24)]))*60)
return
FORMAT(hourNo,"#000")&":"&FORMAT(minuteNO,"#00")&":"&FORMAT(secondNo,"#00")

Hi @christianfcbmx,

 

Did you try the formula like this?

Duración (7*24) =
VAR hourNo =
    INT ( [TotalminutesDiff(7*24)] / 60 )
VAR minuteNO =
    MOD ( 'EXTR-INC&WO-Genérico v4 0 (Chil'[TotalminutesDiff(7*24)], 60 )
VAR secondNo =
    INT ( ( [TotalminutesDiff(7*24)] - INT ( [TotalminutesDiff(7*24)] ) ) * 60 )
RETURN
    TIME ( hourNo, minuteNO, secondNo )

 

Best Regards,

Dale

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

...still an error :(,,,,thank you Thanks Dale anyways!

 

Capa.JPG

Hi @christianfcbmx,

 

The format 00003:07:48 isn't a valid numeric format in Power BI. Maybe you can use the Text mode to display and use another approach to calculate the numeric calculation.

About the format.

format =
VAR allseconds =
    DATEDIFF ( [Start], [End], SECOND )
VAR days =
    INT ( allseconds / 24 / 60 / 60 )
VAR hours =
    MOD ( INT ( allseconds / 60 / 60 ), 24 )
VAR minutes =
    MOD ( INT ( allseconds / 60 ), 60 )
VAR seconds =
    MOD ( allseconds, 60 )
RETURN
    days & "d: "
        & hours
        & "h: "
        & minutes
        & "m: "
        & seconds
        & "s"

Convert_minutes_into_Hours_Minutes_and_Seconds_not_days_getting_a_calculated_column_able_to

 

About the total calculation. You can sum the numeric values fisrt, then format to d:h:m:s.

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
christianfcbmx
Post Patron
Post Patron

This is bacicly the result I´m looking for:

 

Consult.jpg

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.