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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
KirstyMacKinlay
New Member

Format for reporting time spent

Hi

 

I have a report pulled from a spreadsheet which lists time spent by users in a decimal format.  i.e. 0.08 = 5mins

This means that the time spent report displays in decimal, but this does not make reading the report easy.

 

Is there any way of converting the decimal duration into a format that shows in "x hours xx mins". i.e. 2.67 = 2h 40m

 

Thanks

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

hi, @KirstyMacKinlay

You could try this formula as below:

Measure = var h=INT([SUMTIME]/60) return
h&"h"&([SUMTIME]-h*60)&"minte"

or

Measure 2 =
VAR h =
    INT ( [SUMTIME] / 60 )
RETURN
    IF (
        ( [SUMTIME]
            - h * 60 )
            = 0,
        h & "h",
        h & "h"
            & ( [SUMTIME]
            - h * 60 )
            & "minte"
    )

Note: SUMTIME = CALCULATE(SUM(Table2[time spent]))

Result:

6.JPG

 

Best Regards,
Lin

 

 

Community Support Team _ Lin
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

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi, @KirstyMacKinlay

You could try this formula as below:

Measure = var h=INT([SUMTIME]/60) return
h&"h"&([SUMTIME]-h*60)&"minte"

or

Measure 2 =
VAR h =
    INT ( [SUMTIME] / 60 )
RETURN
    IF (
        ( [SUMTIME]
            - h * 60 )
            = 0,
        h & "h",
        h & "h"
            & ( [SUMTIME]
            - h * 60 )
            & "minte"
    )

Note: SUMTIME = CALCULATE(SUM(Table2[time spent]))

Result:

6.JPG

 

Best Regards,
Lin

 

 

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

Hi Lin

 

Thanks, that looks like it should work, but I am finding that I get the same message as I got yesterday from the other suggestion which says "The value for 'SUMTIME' cannot be determines.  Either 'SUMTIME' Doesn't exist, or there is no current row for a column named 'SUMTIME'

 

However, I do have a column for SUMTIME.  I am not able to pick up any of my columns?

 

Thanks

Kirsty

hi, @KirstyMacKinlay

SUMTIME is a measure, not a column.

SUMTIME = CALCULATE(SUM(Table2[time spent]))

You should learn difference between measure and column first.

 

here is a demo pbix, please try it.

 

Best Regards,
Lin

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

you can use FORMAT with calculating number if minutes by multiplying the decimal value by 60:

Measure = FORMAT([Value],INT([Value]) & ":" & FORMAT(ROUND([Value]*60,0),"00"))

or something like this

Measure = FORMAT([Value],INT([Value]) & "h " & FORMAT(ROUND([Value]*60,0),"00m"))

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Thanks Stachu

 

This Measure didn't give me the caluclation that I was looking for.  I just got an error message.

I did manage to get the time converted to a number of minutes. 

 

However, my customer needs the matrix report to show the time as 5hr, not 300min

Or 6hr 56min, not 416min

 

Is there a way of formatting the matrix sum to show the time in this way, rather than in a single unit of time?

 

Thanks

can you share the syntax you used in the end? 


the second measure I posted should work for you, as long as [Value] is the measure where the aggregations is happening and [Measure] is just used to present it differently



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.