WHERE clause in SSRS expression

sion_corn picture sion_corn · Apr 13, 2012 · Viewed 41.5k times · Source

What's the syntax for inserting a WHERE clause in an SSRS expression? I am using BIDS 2008.

=Sum(Fields!QuantityToShip.Value) WHERE FIELDS!Program.Value = "FC"

The code listed above represents the logic I want to use, but obviously inserting the WHERE in there creates a syntax error.

The purpose of this expression is to define a series' value field in a stacked bar chart.

Any help would be greatly appreciated!

Answer

Sir Crispalot picture Sir Crispalot · Apr 13, 2012

Use the IIF method:

=Sum(IIF(Fields!Program.Value = "FC", Fields!QuantityToShip.Value, 0))