Forum Discussion
Irregular Behaviour DAX
- 7 years ago
Hi Anonymous,
When I recreated this, the columns were type Text so I tried this:
IsValidNow = VAR _VALID_TO = DATEVALUE(Pricelist_ADLS[Valid To]) VAR _TODAY = TODAY() RETURN IF(_VALID_TO >=_TODAY,"Yes","No")
If the format was important to you for other reasons, you can wrap your original FORMAT() in a DATEVALUE() - I tried that as well and it works (but this is simpler).
- Anonymous7 years ago
Think the issue here is when you format the date it changes the data type to text. There's no need to format it though, you can just use
Column = if( Table2[Valid To] >= Now(), "Yes", "No")
your variable name is the same as the function name, the other reason may be that NOW() is also returning time, also the formats are not consistent
try this
IsValidNow = VAR _VALID_TO = FORMAT(Pricelist_ADLS[Valid To],"dd-mmm-yyyy") VAR _TODAY = FORMAT(TODAY(),"dd-mmm-yyyy") RETURN IF(_VALID_TO >=_TODAY,"Yes","No")
- Anonymous7 years agoNot applicable
Anonymous , Unfortunately, it didn't solve my issue. It's still the same.
Thanks.
- BekahLoSurdo7 years agoResolver IV
Hi Anonymous,
When I recreated this, the columns were type Text so I tried this:
IsValidNow = VAR _VALID_TO = DATEVALUE(Pricelist_ADLS[Valid To]) VAR _TODAY = TODAY() RETURN IF(_VALID_TO >=_TODAY,"Yes","No")
If the format was important to you for other reasons, you can wrap your original FORMAT() in a DATEVALUE() - I tried that as well and it works (but this is simpler).