x
login about faq Site discussion (meta-askssc)

Sum IIF Problem

I have a tablix report and I am trying to add up values in column a only when values in column b are not null.

So Something like this

Item      Price A               Price B
1234       100                   0
6789       100                   10
4567       200                   20
TTL        300                   30

I have tried this syntax in the rexpression editor =Sum(IIF(Fields!ColimnA.Value > 0 And Fields!ColimnB.Value >0 , 1, 0) "Scope")

this results in an error like "The Value expression for the textbox ‘textbox21’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a data set."

more ▼

asked May 09 '11 at 10:49 AM in Default

siera_gld gravatar image

siera_gld
926 52 70 73

Perhaps it should be ColumnA rather than ColimnA...? or is that just a typo?

May 09 '11 at 01:27 PM ThomasRushton ♦
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

As the error says, if you include the Scope parameter, it must be equal to tne name of the group, data region or data set name.

If you have the formula in the Group footer/header, instead of "Scope" put there the name of the Group. If you have it in the footer of the whole table, you can ommit the Scope parameter, or put there the name of the Data Set.

If you include the Scope parameter, the aggregation will restart with each change in the scope. If you would like cummulative sums even in group footer/hear, you should ommit the Scope parameter.

more ▼

answered May 09 '11 at 11:34 AM

Pavel Pawlowski gravatar image

Pavel Pawlowski
20.3k 5 10 20

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x486
x43
x18
x2

asked: May 09 '11 at 10:49 AM

Seen: 891 times

Last Updated: May 09 '11 at 10:49 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.