Forum Discussion

beerygaz's avatar
beerygaz
Frequent Visitor
8 years ago
Solved

DATEDIFF doubles result

I have a strange situation using DATEDIFF to calculate seconds between two datettime fields.  I add a new column in my report called 'Duration':

 

Duration = DATEDIFF([Alert_Start],[Alert_Finish],SECOND)

 

Here's some sample data:

Alert_Start = 2017/08/27 00:25:22

Alert_Finish = 2017/08/27 00:25:25

 

However:

Result = 6 (I used my finders and worked out it really should be three seconds)

 

Where am I going wrong?

 

 

  • The DAX is OK, are you sure it's not a data issue? Is it counting multiple records against the same index etc? Sample data will proabbly be more help here than anything else.

2 Replies

  • The DAX is OK, are you sure it's not a data issue? Is it counting multiple records against the same index etc? Sample data will proabbly be more help here than anything else.

    • beerygaz's avatar
      beerygaz
      Frequent Visitor

      Thanks for the hint, it seems I had duplicate rows in my database (although why these were being summarised is beyond me) but removing the duplicate rows solved my problem.