I am receiving the cannot use aggregate function on report item error in SSRS when trying to subtotal a group using calculated fields. I am having trouble trying to work around this because my row total is a calculation of two calculating expressions, using the ReportItems! fields to get the total.
To get the row total I have to multiple the total tons by the load rate. To get the tons, I have to use an expression that takes the actual tons delivered and check to see if it meets the minimum contracted tons for that load.
=IIF(Fields!Weight.Value / 2000 < ReportItems!MinTon.Value, ReportItems!MinTon.Value, Fields!Weight.Value / 2000)
So if the load is 22 tons and the minimum contract tons is 24, the value "24" is placed in textbox1. if the total tons delivered is 24.5 tons, the value 24.5 tons is placed in textbox1.
to get the billing total of that load, I use the expression
=ReportItems!Textbox1.Value * Fields!Rate.Value which puts the value in textbox2.
Each Row is placed in a group based on the type of commodity. I need a subtotal by commodity in the group.
So when I SUM(ReportItems!Textbox2.Value) I get the same old aggregate error
I am not sure how to fix this because I am not able to use the IIF function in a calculated field to get each row total and change the ReportItems! to a Fields!.