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
shado26
Helper III
Helper III

Dates/Time/Duration Value Display

Hi All,

hope all are fine 

 

i need your assist here to see time in Days hours minutes and seconds 

444.JPG

 

 

 

 

 

 

 

 

 

 

 

 

i use the below formula for time Diff but it show only days is there any way to see all  and as my frist action are Quote Closed i don't want formula to calculate the time here 

TIme Diff = if(Merge1[ActionName]="Quote Closed",0,DATEDIFF(Merge1[Pervious action],Merge1[Current A
tion],MINUTE)/1440)

 

also i tried the below formula for Day hours minute & Seconds its how negative time which i want to remove as well 

 

Time = 
var allseconds = DATEDIFF(Merge1[Pervious action],Merge1[Current Action],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 &" days " & hours & " hours " & minutes & " minutes " & seconds & " seconds" & IF(Merge1[ActionName]="Quote Closed",0)

 

at the end i need to see each step time and to get sum all of time 

 

appreciate if you can help me on this 

 

BR 

Shadi

1 ACCEPTED SOLUTION

Hello @shado26,

 

I cannot share the pbix file, but these are steps that I folowed.

 

1. Make a calculated column:

Datediff = DATEDIFF(Merge1[Pervious Time],Merge1[Current Time],SECOND)

 

2. Make a calculated measure:

Measure =
VAR TotalSeconds=SUM(Merge1[Datediff])
VAR Days =TRUNC(TotalSeconds/3600/24)
VAR Hours = TRUNC((TotalSeconds-Days*3600*24)/3600)
VAR Mins =TRUNC(MOD(TotalSeconds,3600)/60)
VAR Secs = CEILING(MOD(TotalSeconds,60),1)
return IF(DAYS=0,"",IF(DAYS>1,DAYS&" days "))&IF(Hours<10,"0"&Hours,Hours)&" hours "&IF(Mins<10,"0"&Mins,Mins)&" minutes "&IF(Secs<10,"0"&Secs,Secs)&" seconds "

 

Please let me know if this worked.

View solution in original post

16 REPLIES 16
rajulshah
Super User
Super User

Hello @shado26,

 

You can use the measure to sum all the time differences and time difference will be calculated as calculated column.

 

Regards.

Hello @rajulshah

 

thank for reply but i need to see all Day hours minute & Seconds

Can you replicate the result data you want to see?

 

I cannot understand the requirement properly.

 

 

hello @rajulshah

 

1- on time Diff formula i want to Day hours minute & Seconds if it can be done 

2- on Time formula i need to rmeove negative time and sum all the time 

Do you want data shown as below? Please confirm.

 

daytime.JPG

YEs but i correct Value as per my Ex it should be 

 

8 day 00 Hours 49 minutes 31 seconds 

good morning guys 

 

appreciate if you can help me here 

Hello @shado26,

 

 

You can try here this:

 

Booking Creation to Appointment =
VAR TotalSeconds=SUM(table[differenceintime])
VAR Days =TRUNC(TotalSeconds/3600/24)
VAR Hours = TRUNC((TotalSeconds-Days*3600*24)/3600)
VAR Mins =TRUNC(MOD(TotalSeconds,3600)/60)
VAR Secs = CEILING(MOD(TotalSeconds,60),1)
return IF(DAYS=0,"",IF(DAYS>1,DAYS&" days "))&IF(Hours<10,"0"&Hours,Hours)&" hours "&IF(Mins<10,"0"&Mins,Mins)&" minutes "&IF(Secs<10,"0"&Secs,Secs)&" seconds "

 

Hope this works.

HI @rajulshah

 

thank you for your reply  but still not work its show the same duration time in all lines 

Hi @shado26,

Could you please share your .pbix file for further analysing? So that we can provide dedicted solution.

Best Regards,
Angelia

HI @v-huizhn-msft

 

kindly find attach file for your help and assist 

 

Test File

Hello @shado26,

 

Is this what you want?

See below:datediff.JPG

Please confirm. 

 

 

Yes thats is can you share the PBIX 

Hello @shado26,

 

I cannot share the pbix file, but these are steps that I folowed.

 

1. Make a calculated column:

Datediff = DATEDIFF(Merge1[Pervious Time],Merge1[Current Time],SECOND)

 

2. Make a calculated measure:

Measure =
VAR TotalSeconds=SUM(Merge1[Datediff])
VAR Days =TRUNC(TotalSeconds/3600/24)
VAR Hours = TRUNC((TotalSeconds-Days*3600*24)/3600)
VAR Mins =TRUNC(MOD(TotalSeconds,3600)/60)
VAR Secs = CEILING(MOD(TotalSeconds,60),1)
return IF(DAYS=0,"",IF(DAYS>1,DAYS&" days "))&IF(Hours<10,"0"&Hours,Hours)&" hours "&IF(Mins<10,"0"&Mins,Mins)&" minutes "&IF(Secs<10,"0"&Secs,Secs)&" seconds "

 

Please let me know if this worked.

Hi @rajulshah

 

can we add in this formula to exclude the weekends and working time 

 

please note that our weekend Friday and Saturday 

 

& working hours from 9 AM to 5 PM

thank you @rajulshah work perfectly 

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.