How do you calculate the last 4 months from month was choice on month slicer ?
if choice month 10 in slicer I want to see sum amount for moths 10,9,8,7 only
calculate ( [sumAmount], ???? )
thanks
Let - your slicer generating from table "Dates" and the column name is "Date". Considering this, you can go for a measures as below to achieve your required output-
Measure: 1
4_month_start_date =
VAR start_of_selected_month = STARTOFMONTH(Dates[Date])
VAR start_of_4_month = EDATE(start_of_selected_month,-3)
RETURN start_of_4_month
Measure: 2
4_month_end_date = SELECTEDVALUE(Dates[date])
Measure: 3
4_month_sum =
CALCULATE(
SUM(your_table[sumAmount]),
DATESBETWEEN
(
'Dates'[Date],
[4_month_start_date],
[4_month_end_date]
)
)
Hope this will help!