Forum Discussion

sakamotothais's avatar
sakamotothais
Helper III
9 years ago
Solved

Comparison function with if in Dax

 

Good afternoon,
I am trying to compare values ​​between today's date and yesterday's date. And I want to create an alert where it decreases and where it increases from yesterday to today. But I can not get into the Dax function. Anyone have suggestions?

 

Column1 = IF(TODAY()-1 > TODAY(),"+","-")

 

Column2 = IF([value_flt_base], TODAY()-1 >[value_flt_base], TODAY(),"+","-")

 

Thanks

  • sakamotothais's avatar
    sakamotothais
    9 years ago

     

    I'm using it as a solution:

     

    SUMX (
    FILTER (QL2_Alerts, QL2_Alerts[dtt_data_captura] = MAX (QL2_Alerts[dtt_data_captura])),
    QL2_Alerts[flt_base])

     

     

10 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I do not understand what you're trying to do with these formulas.

     

    TODAY() - 1 will give you yesterday's date. So Column1 will always return "-" because yesterday's date is never greater than today's date.

     

    Your Column2 is an IF statement with 5 arguments. The IF formula takes 3 arguments: IF(<condition to check>, <result if condition is true>, <result if condition is false>)

     

    What does this table even look like? How would you compare one date's value to today's? Is there a date column? I'm not even sure this should be a column. This sounds like the sort of thing that should be a measure but it's very unclear from your examples.

    • sakamotothais's avatar
      sakamotothais
      Helper III

      I have three columns.

      The Date, Place and Value

      I want to compare the Value of yesterday's date d-1 with the value of today's date d0,

      to check if there was an increase or decrease between yesterday and today.

      In which localities there was increase and which localities had reduction.

       

      LocalDateValue
      Brazil20170621174.52
      EUA20170620157.66
      EUA 20170621487.69
      Brazil 20170620497.65

       

      Thanks 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Do you have a date table?