Forum Discussion

shado26's avatar
shado26
Icon for Helper III rankHelper III
8 years ago
Solved

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                          i use the below formula for time Diff but it show onl...
  • rajulshah's avatar
    rajulshah
    8 years ago

    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.