Solved

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

Posted on 2015-01-23
2
260 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 500 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

628 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