Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
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 video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now