Forum Discussion

dp_75's avatar
dp_75
Frequent Visitor
1 year ago
Solved

retrieving average value for base year, by segments

Hi there, Can anyone help with a query related to my previous one...trying to retrieve a calculated average value for a base year,  next to the selected later dates, and to be compatible with filter...
  • lbendlin's avatar
    1 year ago

    If you want to do date math you will want to add a calendar table to your data model.

     

    Calc 2019 Avg = var yd = 2019-max('Calendar'[Year]) return CALCULATE(AVERAGE(Sheet1[value]),DATEADD('Calendar'[Date],yd,YEAR))

     

    see attached.

  • lbendlin's avatar
    lbendlin
    1 year ago

    which values do you think are incorrect?  Remember that 2024 isn't complete yet.