Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Date comparison shows wrong results

I am trying to compare two dates like below. however it is not giving me correct results.

Column = if(table[LAST DAY] >= ([SELECTED DAY]) , "yes", "no")
Result:
LAST DAY               SELECTED DAY          COLUMN
06/30/2014              09/30/2022                YES
Note:  SELECTED DAY  is a measure and this value is coming from slicer. LAST DAY is a column and I want to compare this column with selected silcer value.

 

12 Replies

  • bolfri's avatar
    bolfri
    Icon for Solution Sage rankSolution Sage

    You can't put a measure into column like this. This won't work.

    If you are using [Selected Day] = SELECTEDVALUE(sometable[somedatecolumn]) then in table it suppose to return BLANK() and every null is lower than any date.

    • Anonymous's avatar
      Anonymous
      Not applicable

      bolfri I am using [Selected Day] = CALCULATE(MIN(calendar[date_column]), ALLSELECTED('calendar')) and this gives me correct values not Blank.

      so I am getting below results. so looks like SELECT DAY is fetching right values through out the rows for slicer value but the if statement is not working.

      LAST DAY               SELECTED DAY          COLUMN
      06/30/2014              09/30/2022                YES

      07/31/2014               09/30/2022                YES

      • bolfri's avatar
        bolfri
        Icon for Solution Sage rankSolution Sage

        You said that SELECTED DAY is coming from the slicer.

         

        Are you putting column in data table or table in viz?

         

        Column = 'Sample'[LAST DAY] > 'Sample'[SELECTED DAY]