Difference between 2 dates giving unexpected result

Hello,

I have created a calculation taking the difference in days between Issue Target end and Issue status last updated date:

“Delivered vs. Expected” = DateDiffWorkdays([Measures].[Issue Target end], [Measures].[Issue status updated date])

Here are the results below…it works properly for most but I get conflicting results when the dates are similar.

As you can see, the rows highlighted in YELLOW show the same date for each field, and the result of the calculation shows 1.
The rows circled in RED show the same date for each field, and the result of the calculation shows 0.
They are the exact same date. It should always show 0, for both the YELLOW and the RED.

The row circled in blue should be -1. Why is it showing 0?

I am getting very inconsistent results with this calculation. I have tried doing a TimestampToDate function and a DateWithoutTime function and neither of those worked.

Hi @dani

Your calculation seems correct.
Currently, the result is rounded as an integer; therefore, for two exact dates, it could be 0 (if there is less than half a day between two timestamps) or 1 (if it is more), or -1.
Please change the measure formatting to Decimal; then you will see the exact value.

To better assess the result, you may also want to check if the Target end date has only a date (then the time always will be 00:00 for that date) or an exact timestamp; the issue status last updated date is a timestamp.

Best
Ilze, support@eazybi.com