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

Convert Times to actual minutes and actual seconds

Hi All, 

 

Wondering if you could help?

 

I have a column of time stamps for Duration in Heart rate zone and managed to convert it into minutes and seconds using the formula: HOUR(TBLHR[Aerobic zone 1 (hh:mm:ss)])*60+MINUTE(TBLHR[Aerobic zone 1 (hh:mm:ss)])+SECOND(TBLHR[Aerobic zone 1 (hh:mm:ss)])/60 which has been working fine - ie 00:16:47 = 16.783. 

 

However, my athletes and some colleagues are finding this difficult to understand and would rather see the number as 16.47 (actual minutes and actual seconds in number form) for the ease of understanding. 

 

Is there a way of doing this converstion easy?

 

Really appreciate any help on this.

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @SportStudent ,

Maybe you could add some text to identify like this:

10.26.5.1.PNG

To do this, add a Second Column using the following formula:

secondColumn =
HOUR ( 'TBLHR'[Aerobic zone 1 (hh:mm:ss)] ) * 3600
    + MINUTE ( 'TBLHR'[Aerobic zone 1 (hh:mm:ss)] ) * 60
    + SECOND ( 'TBLHR'[Aerobic zone 1 (hh:mm:ss)] )

Then create a measure based on the new column:

Measure =
VAR TotalSeconds =
    MAX ( 'TBLHR'[secondColumn] )
VAR Hors =
    TRUNC ( ( TotalSeconds ) / 3600 )
VAR Mins =
    TRUNC ( MOD ( TotalSeconds, 3600 ) / 60 )
VAR Secs =
    MOD ( TotalSeconds, 60 )
RETURN
    IF ( Hors < 10, "0" & Hors, Hors ) & "h"
        & IF ( Mins < 10, "0" & Mins, Mins ) & "m"
        & IF ( Secs < 10, "0" & Secs, Secs ) & "s"

Here is the pbix file

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

View solution in original post

4 REPLIES 4
v-eqin-msft
Community Support
Community Support

Hi @SportStudent ,


Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,
Eyelyn Qin

Hi Eyelyn,

 

Apologies for my delay - I only just saw the notification - thank you for your help, it worked perfectly! 

 

Kindest,

             Sport Student

v-eqin-msft
Community Support
Community Support

Hi @SportStudent ,

Maybe you could add some text to identify like this:

10.26.5.1.PNG

To do this, add a Second Column using the following formula:

secondColumn =
HOUR ( 'TBLHR'[Aerobic zone 1 (hh:mm:ss)] ) * 3600
    + MINUTE ( 'TBLHR'[Aerobic zone 1 (hh:mm:ss)] ) * 60
    + SECOND ( 'TBLHR'[Aerobic zone 1 (hh:mm:ss)] )

Then create a measure based on the new column:

Measure =
VAR TotalSeconds =
    MAX ( 'TBLHR'[secondColumn] )
VAR Hors =
    TRUNC ( ( TotalSeconds ) / 3600 )
VAR Mins =
    TRUNC ( MOD ( TotalSeconds, 3600 ) / 60 )
VAR Secs =
    MOD ( TotalSeconds, 60 )
RETURN
    IF ( Hors < 10, "0" & Hors, Hors ) & "h"
        & IF ( Mins < 10, "0" & Mins, Mins ) & "m"
        & IF ( Secs < 10, "0" & Secs, Secs ) & "s"

Here is the pbix file

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.

 

Best Regards,
Eyelyn Qin

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.