Forum Discussion
Where have I gone wrong with datediff measure?
- Anonymous3 years ago
Hi richrich123 ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a measure.
Older than 2 days = IF(DATEDIFF(SELECTEDVALUE('Case'[lastcustomerupdate]),TODAY(),DAY)>2,1,0)(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
try it now :
Older than 2 days = IF( DATEDIFF(SELECTEDVALUE('Case'[lastcustomerupdate].[Date]),TODAY(), DAY) < -2,1,0)
- Idrissshatila3 years ago
Super User
Weird, you're sure its the right date field that's referenced in the dax measure?
- richrich1233 years ago
Helper III
Idrissshatila Have double checked and also removed and re-added fields. You can see the date field and the dax measure both tie up and are the same measure and date field in the measure as is applied to the table fields? Have double checked and all looks spot on
Checked it is 100% formatted as a date field as well and all fine
- Idrissshatila3 years ago
Super User
Try this:
Older than 2 days = IF( DATEDIFF('Case'[lastcustomerupdate],TODAY(), DAY) >2,1,0)
- richrich1233 years ago
Helper III
- Idrissshatila3 years ago
Super User
then lets try it like this
Older than 2 days = IF( DATEDIFF(SELECTEDVALUE('Case'[lastcustomerupdate].[Date]),TODAY(), DAY) >2,1,0)
- richrich1233 years ago
Helper III
The measure works but again, output for a date far greater than 2 days old is still zero.
- Anonymous3 years agoNot applicable
Hi richrich123 ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create a measure.
Older than 2 days = IF(DATEDIFF(SELECTEDVALUE('Case'[lastcustomerupdate]),TODAY(),DAY)>2,1,0)(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- richrich1233 years ago
Helper III
Anonymous - amazing - that has worked, thanks very much for your assitance, much appreciated.