I have a data with Dept name and its corresponding Amount for each Dept for each Month like below :
Table1 :
Dept name Amount Period
XXX 20 Jan,2018
XXX 30 Feb,2018
XXX 50 Mar,2018
XXX 70 April,2018
....
YYYY 20 Jan,2018
YYYY 30 Feb,2018
YYYY 50 Mar,2018
YYYY 70 April,2018
....
I need to calculate the Average of Last 3 months (Ex. For Dept XXXX, If I select April Month, It needs to calculate the average Amount of (Jan,Feb,Mar)(20+30+50)/3 =33.33)
and Compare the same with current (April) month (70)
I've created a calculated column for Last 3month Average as below (I have also created a Calender Table in Power BI)
AVG3mth =
CALCULATE(SUM('Table1'[Amount]),DATESINPERIOD(Calender[Date],LASTDATE('Table1'[Period]),-3,MONTH))/3
(But it just dividing the current month by 3 and not the Last 3 Mnths.)
and when comparing If the Average of Last 3 months greater than current month I should highlight it as "YES" since the Amount is dropped when comparing to last 3 months. I have added another column as "Dropped?" for the same.
Dropped? = IF(VALUES('Table1'[Amount])<[AVG3mth], "Yes", "No")
And also If I choose the Particular month (Period) in slicer I need to get those Month, Amount, Last 3 months average and Dropped YES/NO alone in my Report.
Attached my current report screenshot (You will get clear idea if you look into this)