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

Duration/ ROUND?

Hello,

 

I finally managed to sum my durations but in the Visual it shows not the correct duration like 14:00. It shows me 13:60. When I add a minute it will show 13:61. How can I fix this? 

Duration =
// We start with a duration in number of seconds
VAR Duration = SUM(Table[Column)])
// There are 86,400 seconds in an day
VAR Days = INT ( Duration / 86400)
// There are 3600 seconds in a hour
VAR Hours = INT ( MOD( Duration - ( Days * 86400 ),86400 ) / 3600)
// Remaining seconds are the remainder of the seconds divided by 60 after subtracting out the hours
VAR Minutes = INT (MOD ( MOD( Duration - ( Days * 86400 ),86400 ), 3600 ) / 60)
RETURN
// We put the hours, minutes and seconds into the proper "place"
Hours * 100 + Minutes
6 REPLIES 6
v-xiaoyan-msft
Community Support
Community Support

Hi @Anonymous ,

 

Sample data without sensitive information and expected output would help tremendously.
Please see this post regarding: How-to-provide-sample-data-in-the-Power-BI-Forum 

 

Hope it helps,


Community Support Team _ Caitlyn

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

@Anonymous Looks like you are using Chelsie Eiden's Duration - Microsoft Power BI Community. Would need to see sample data to test.

 

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler  Yes it is Chelsie Eidens Measure 😄 The durations are in seconds. It should show me 14:00, not 13:60. Thanks.

 

 

 

 

@Anonymous Can you paste the sample data as text? I really don't want to do a bunch of typing.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Tahreem24
Super User
Super User

@Anonymous  Try to use ROUND function to rounding it.

MEASURE = ROUND(Table[DurationColumn],0)

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

Didnt work

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.