I am trying to create a sum value of a variable in SSRS. The variable is used to calculate the month previous to the one selected to compare items in the 2 months.
|Month N-1 | Month N
Item X| 25 | 45
This is the code to calculate the previous month:
=iif(Parameters!Month.Value = 1, 12, Parameters!Month.Value - 1)
This is the code to calculate if the item has is in this month and tally them up:
=sum(iif(Month(Fields!ReportDate.Value) = Variables!PriorMonth1.Value, 1,0))
However, I get this error upon running the report:
Contains a variable reference in the argument to an aggregate function (or RunningValue). Variable values cannot be used in aggregate functions.
You should not need a variable to do this.
I can't test this at the moment but I think this should work.
All I've done here is calc the previous month number directly in the expression.