Forum Discussion
Anonymous
4 years agoNot applicable
DATEDIFF Returns a Blank()
I am trying to Count Number of records where the ExpiryDate is more than 6 months old. It works fine when the expiryDate is more than 6 months old, however, if it is 0, then it returns Blank() instea...
- 4 years ago
Hi Anonymous ,
Generally, DATEDIFF function can automatically return 0.
You say you want to "Count Number of records where the ExpiryDate is more than 6 months old", so do you have another formula of count?
In my sample, I also create a count measure.
measure = CALCULATE ( COUNT ( location[expiry_date] ), FILTER ( 'location', DATEDIFF ( 'location'[expiry_date], TODAY (), MONTH ) > 1 ) )Get the correct result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tamerj1
Community Champion
4 years agoHi Anonymous
please try
No_of_Days =
SUMX (
VALUES ( 'location'[expiry_date] ),
IF ( DATEDIFF ( 'location'[expiry_date], TODAY (), MONTH ) > 6, 1, 0 )
)