This is my problem. I am trying to calculate 3 month average every month (rolling) with last value.
For example:
ID SCORE DATE
2 3 3/19
1 * 2 4/19
6 3 5/19 May(avg Mar,Apr,May) 3+*2+3+4/4 = 3
3 4 5/19
4 4 6/19 June(avg April May June) 3+4+4+*3+5/5= 3.8
1 * 3 6/19
6 5 6/19
So May average would be would be 3 (12(Mar,Apr,May)/4) and the value for ID 1 Score=2
But in June average would be would be 3.8 (19(Apr,May,Jun)/5) and the value for ID 1 Score=3.
I tried to follow this https://community.powerbi.com/t5/Desktop/Rolling-3-Month-Average/m-p/695325#M335440) , what I need is the way to filter or pass only the lastest values to be used for sum.
Rolling 3msc =
VAR PeriodEnd =
LASTDATE ( 'Table'[Date] )
VAR PeriodStart =
FIRSTDATE ( DATESINPERIOD ( 'Table'[Date], PeriodEnd, -3, MONTH ) )
RETURN
CALCULATE (
SUM ( 'Table'[Score] ),
DATESBETWEEN ( 'Table'[Date], PeriodStart, PeriodEnd )
) # what I need to figure out how to sum the score based
on the last score in this period
/ CALCULATE (
DISTINCTCOUNT ( 'Table'[ID] ),
DATESBETWEEN ( 'Table'[Date], PeriodStart, PeriodEnd )
)