question

siera_gld avatar image
siera_gld asked

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."
ssrsaggregatessumiif
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image ThomasRushton ♦♦ commented ·
Perhaps it should be `ColumnA` rather than `ColimnA`...? or is that just a typo?
0 Likes 0 ·

1 Answer

·
Pavel Pawlowski avatar image
Pavel Pawlowski answered
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.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.