?
Solved

SSRS 2008r2 Create subtotal for a group using calculated fields to avoid aggragate error

Posted on 2015-01-23
2
Medium Priority
?
271 Views
Last Modified: 2015-01-24
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!.  

any ideas

Thank you.
0
Comment
Question by:rtay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
DcpKing earned 2000 total points
ID: 40568164
Have you thought of writing a stored procedure the do the first step of calculations? It could then supply your report with (Item times rate) as a single value. Then you could do the single allowed level of calculation that you desire on the report.

hth

Mike
0
 
LVL 5

Author Comment

by:rtay
ID: 40568572
I tried everything.....but that.  Helps to have someone point to the obvious.  Sounds like it should work.  Thanks
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question