Forum Discussion
Override Year Slicer For Previous Measure
Hello, I have a matrix with monthly costs, along with the variances from month to month. I have a slicer to select the year, but I also want to inlcude the cost for the previous December, in order to calculate the Decemeber Prior Year/January variance. See screen shot below.
Prior December measure:
Here is the link to the pbix.
https://drive.google.com/file/d/1V1M0Dho5P7ICGhvXTBaPPwaUNpzOs1_E/view?usp=drive_link
Thank you in advance,
Sorry about the previous post. The following formula works
DecCostPriorYr =VAR YearSelectedLessOne =SELECTEDVALUE(PlanCost[Year]) - 1VAR CostCalc =CALCULATE(SUM(PlanCost[Cost]),FILTER(ALL(PlanCost[Community],PlanCost[Month],PlanCost[Year]),PlanCost[Month] = 12 && PlanCost[Year] = YearSelectedLessOne))RETURNCostCalc
8 Replies
- Pady
Helper II
Please change replace ALL with ALLSELECTED . Hope it works.
DecCostPriorYr =
VAR YearSelectedLessOne =
SELECTEDVALUE(PlanCost[Year]) - 1
VAR CostCalc =
CALCULATE(SUM(PlanCost[Cost]),
FILTER(ALLSELECTED(PlanCost),
PlanCost[Month] = 12 &&
PlanCost[Year] = YearSelectedLessOne))
RETURN
CostCalc