Monday, March 19, 2012

Conditional Sum?

Hi,

Is it possible to have a conditional sum based on an item type existance in a set of values?

Example if i have the following set:

A

A

A

A

B

I just wanna sum B else if B doens't exist sum A

Best Regards,

Luis Simoes

Have an invisible textbox in your report with the expression and say the name of the textbox is textbox20:

Count(IIf(Fields!ItemType.Value = "A", Fields!YourField.Value, 0))

Then use this expression for summing:

Sum(IIf(ReportItems1textbox20.Value > 0, IIf(Fields!ItemType.Value = "A", Fields!YourField.Value, 0), 0))

Shyam

|||

Yes that would do the trick!

I can also use that count in the field formula right? Or it does affect performance that much?

Thanks,

Regards,

Luis Simoes

|||

Hello,

Doing this gives me two errors in the summing field.

"The value expression for the textbox 'textbox30' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers."

"The value expression for the textbox ‘textbox30’ refers to the report item ‘textbox28’. Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope."

Any idea why?


No comments:

Post a Comment