Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
sraj
Responsive Resident
Responsive Resident

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 APPWAITtime should be (00:01:37) but the below measure gives me (1)
 
# of Mins APPWAITtime =
DATEDIFF('vw_MeetingWaitTimes'[MovedToQueue],'vw_MeetingWaitTimes'[InPlace],MINUTE)
 
Please advise.
1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

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)

 

 

ddif.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
PhilipTreacy
Super User
Super User

Hi @sraj 

 

Imposible to say what is hapenning without seeing your data that the measure is acting on.  Can you provide it?  At least a snapshot of the data producing blanks?

 

As the measure works with my data, something must be different at your end.

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


PhilipTreacy
Super User
Super User

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)

 

 

ddif.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


sraj
Responsive Resident
Responsive Resident

I am not sure why but after I used this all I am seeing blanks, no values.  Do I need to change the format or something?

 

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

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.