September 5, 2012 at 6:09 pm
Hey everyone,
I'm building a report where I'm trying to write an expression for a variable (not parameter). I'm planning on creating multiple variables from different datasets which I can then use/reference it to do a calculation in single textbox.
I have multiple datasets, and I need the SUM(SUM(Fields!amount.Value)) for each of these datasets. I am then going to use these numbers in another textbox, adding them with each other. I need some assistance with the syntax. I am able to use SUM by itself, without an issue. For example, this works fine:
Variable 1:
=SUM(Fields!Amount.Value, "DataSet1")
Variable 2:
=SUM(Fields!Amount.Value, "DataSet2")
etc.
But I get an error when trying to amend it to the following (which is what I actually need):
=SUM(SUM(Fields!amt.Value, "DataSet1"))
I get an error saying "The variable expression for the report 'body' uses an aggregate expression without a scope. A scope is required for all aggregates used outside of a data region unless the report contains exactly one dataset." I have a hunch that there's a problem with my syntax/parantheses placement. Any suggestions?
September 5, 2012 at 8:11 pm
Duplicate Post. Please do not cross-post, it just confuses attempts to help you.
Please direct all responses to http://www.sqlservercentral.com/Forums/Topic1354967-1633-1.aspx
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
September 5, 2012 at 9:21 pm
Sorry and thanks.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply