how to sum a formula in SQL Reporting Services 2008


Attached is an rdl.  I'm trying to produce a Grand Total for the "Sales Amt" column of this report.  (That column is the final column on the right.)

In that Sales Amt column, I already have a group sum.  And, the "Sales Amt" field itself in that column is a formula .  

I need a grand total.  This will amount to a third field in this column.  

How do I create this?


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you trying to Sum Sums?
apitechAuthor Commented:
Exactly.  I know that there is not a way to do that.  But, that's how I was trying to explain it here in this posting.

The following is the group formula in SQL Reporting Services 2008 that sums the extended price column and specifically for each item class:


Now, I want to do a “grand total” for this formula (on this column).  But, I cannot find the means to do this in SSRS.  I have tried doing a sum of that sum and I have tried the RunningValue function based on the textbox that this formula is in.  No dice.  

Thoughts would be very, very much appreciated!


I know in BO I have to make separate variables for each Sum I had to cast the Sum ToNumber then Sum the Cast Results. I believe this is how I did it

First Step: As Variable
ToNumber ({@Sum FlxFstDisp})

Second Step: As Variable
Sum ({@FlexFstDispAmt})

Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

apitechAuthor Commented:
Do I place these into the Expression "area" of the field?  Are these formulas?
Alpesh PatelAssistant ConsultantCommented:
Put Sum in variable and use at last.
apitechAuthor Commented:
Again, I ask "Do I place these into the Expression "area" of the field?  Are these formulas?"
Yes these would be formula's in expression format using a variable in the variable editor.
apitechAuthor Commented:
I'm still not seeing how this works.  Where is the "variable editor"?  Where do I place these formulas at?  How many variables do I creat?  How do I glean a "Grand Total" field (my ultimate goal) from definining variables?

I'm a total novice on how variables work in SQL Reporting Services 2008 (and 2005).  Could someone please methodically point out how I can get this accomplished?

I do appreciate the responses that I have received, thus far.  But, I do need step by step directions on this issue.

Thanks!  Again, it's very appreciated!

Nico BontenbalCommented:
At the bottom of your screen in the Row Groups section right click the ItemClass row and select Add Total|After. This will give you a new total row. Right click the cell in the Sales Amt column on the Total row and choose Expression. Here you enter:
=sum(iif(Fields!SOPTYPE.Value=4,  -Fields!XTNDPRCE.Value,  Fields!XTNDPRCE.Value))
This should give you the total.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
apitechAuthor Commented:
Hi Nicobo!

That's exactly what I needed!  Thank you!!!!!!!!!!!!

That worked!!!

I was looking for something really simple like that!

Whew!  I was hoping that you would chime in on this!  Thank you, again, for doing so!

You're the best!

apitechAuthor Commented:
Nicobo is awesome!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.