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
Anonymous
Not applicable

Time/Duration Value Display

I am looking for a way to display total duration that is over 24 hours. 

 

Currently if the sum of two durations is 34:22 hours it will display as: 

 

10:22 

 

This must be because the Power BI value is based on a 24 hour clock. Therefore it is going to 24:00 then rolling back around to the 10:22 value. 

 

In excel you can fix this by using a custom time field as [hh]:MM. I dont see that option in Power BI anyone have any suggestions on how to fix this? 

2 ACCEPTED SOLUTIONS
Stachu
Community Champion
Community Champion

I would try this, the format is text

Measure = 
VAR Hours = INT([Total Duration]*24)
VAR Minutes = RIGHT(FORMAT([Total Duration],"hh:mm"),2)
RETURN
Hours & ":" & Minutes 


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

View solution in original post

Stachu
Community Champion
Community Champion

try this

Measure = 
VAR Hours = INT([Total Duration]*24)
VAR Minutes = RIGHT(FORMAT([Total Duration],"hh:mm"),2)
VAR Separator = IF([Total Duration]=BLANK(),BLANK(),":")
RETURN
Hours & Separator & Minutes 


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

View solution in original post

8 REPLIES 8
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

IF you want the result to be formatted as "HH:MM", its data type will be forced to text rather than date or numeric. Suppose you have generated a measure to get the total duration, to display total duration based on a 24 hour clock, please try this measure:

Measure =
IF (
    VALUE ( LEFT ( [Total duration], 2 ) ) < 24,
    [Total duration],
    VALUE ( LEFT ( [Total duration], 2 ) )
        - INT ( VALUE ( LEFT ( [Total duration], 2 ) ) / 24 )
            * 24
        & ":"
        & RIGHT ( [Total duration], 2 )
)

Regards,

Yuliana Gu

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

Thank you so much for the guide. When I applied this measure it displayed "12/31/1899" for all of my measures. I tried changing the data type to time, text, general, whole number and none of them seemed to solve the issue. Any ideas? 

Stachu
Community Champion
Community Champion

I would try this, the format is text

Measure = 
VAR Hours = INT([Total Duration]*24)
VAR Minutes = RIGHT(FORMAT([Total Duration],"hh:mm"),2)
RETURN
Hours & ":" & Minutes 


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

Anonymous
Not applicable

@Stachu The issue I have now is that I get a ":" for values that should be blank. I tried an if statment but cant get it to work properly. any suggestions? 

Stachu
Community Champion
Community Champion

try this

Measure = 
VAR Hours = INT([Total Duration]*24)
VAR Minutes = RIGHT(FORMAT([Total Duration],"hh:mm"),2)
VAR Separator = IF([Total Duration]=BLANK(),BLANK(),":")
RETURN
Hours & Separator & Minutes 


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

Anonymous
Not applicable

**bleep**, Your good! Thank you so much. I have been trying to figure this out for a month! WOrked like a charm! 

Anonymous
Not applicable

Worked like a charm! Thanks so much! 

Anonymous
Not applicable

Currently my formula is... Worked = SUMX(SUMMARIZE(VALUES(ReportA_PQ[Date]),[Date],"ABCD",[Logout]-[Login]-[Lunch]),[ABCD])

 

anyone have any ideas? 

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.