Forum Discussion

sraj's avatar
sraj
Responsive Resident
3 years ago
Solved

Measure time difference

Hi - I am using this measure, and for some reason I am getting the values rounded up.    For instance : Moved ToQueue = Thu, 01 Jun 2023 12:13:00 InPlace = Thu, 01 Jun 2023 12:14:38 # of Mins ...
  • PhilipTreacy's avatar
    3 years ago

    Hi sraj 

     

    Download example PBIX file

     

    You're asking DATEDIFF the difference in minutes between the two date-times.  It doesn't take the seconds into account.

     

    So there is only 1 minute difference betwen 12:13 and 12:14.

     

    You need to change MINUTE to SECOND and you'll get 98 seconds, then convert that into minutes.

     

     

    # of Mins APPWAITtime = 
    
    VAR _Diff = DIVIDE(DATEDIFF(SELECTEDVALUE('vw_MeetingWaitTimes'[MoveToQueue]), SELECTEDVALUE('vw_MeetingWaitTimes'[InPlace]),SECOND),60)
    VAR _Mins = INT(_Diff)
    VAR _Seconds = _Diff - _Mins
    
    RETURN _Mins + (_Seconds * 60 / 100)
    

     

     

     

    Regards

     

    Phil