Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Irregular Behaviour DAX

Hello,   I am using the DAX to filter a valid date which is greater than today's date. I see it misbehaving in the following example I am using the DAX below,   IsValidNow = VAR VALID_TO = FO...
  • BekahLoSurdo's avatar
    BekahLoSurdo
    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).

  • Anonymous's avatar
    Anonymous
    7 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")