Solved

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

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to specify windows account to use for connection manager in SSIS package 25 80
Sorting a SQL script 5 41
mssql 7 32
SQL Server 2012 and core licensing 5 31
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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.

734 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