Forum Discussion

Regnbagar1's avatar
Regnbagar1
Icon for Helper I rankHelper I
4 years ago
Solved

Measure doesn't work with filters

Hi! I have created a measure that should calculate the SUM of the last three months. The measure only works for one of the countries when I use a dimension table as filter. In this case the measur...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Regnbagar1 ,

     

    Sorry for my late reply.

    You could try the following to create a column:

    Column = 
    var _last3months=EOMONTH([yearmonth],-3)
    return CALCULATE(SUM('Table'[Value]),FILTER('Table',[country]=EARLIER('Table'[country]) && [yearmonth]>_last3months &&[yearmonth]<= EARLIER('Table'[yearmonth])))

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.