Forum Discussion

bastienmol's avatar
bastienmol
Frequent Visitor
3 years ago
Solved

Dateadd does not work in DAX in variable

Dear all   I have this formula  Sales Last Week  = CALCULATE(sum('Daily KPI'[sales]),DATEADD('Daily KPI'[date],-7,DAY)) This one is working - it gives me sales for Last Week   However when I t...
  • lucadelicio's avatar
    lucadelicio
    3 years ago

    You have to pass a measure that select a different measure different by case (not a variable).
    Something like this:
    MEASURE SWITCH = IF(x > 1, Measure1, Measure2)

    MEASURE = CALCULATE(MEASURE SWITCH, DATEADD('Daily KPI'[ga_date],-7,DAY))

    So the MEASURE will return the calculate of the measure switch that it will be Measure1 or Measure2.

    I hope i'll be helpful
    mark as a solution if you resolve
    Ciao!