Paginated Report sum expressions based on condition

Advertisements

Hi Guys i have this expressions where i sum sales based on multiple conditions

=iif(Fields!ContName.Value="Africa") and
    iif(Fields!Country.Value="Ethiopia") and
      iif(Fields!City.Value="Adama") ,sum(Fields!Sale.Value),
        0)

what i want is if all the condions are true it should sum the sales values. For some reason it is not working. Any help Thanks

>Solution :

You only need one IIF and the SUM needs to be on the outside of it to SUM the individual records.

=SUM(IIF(Fields!ContName.Value = "Africa" and Fields!Country.Value = "Ethiopia" and Fields!City.Value = "Adama", Fields!Sale.Value, 0))

The 0 may need to be changed to CDEC(0) if your Sale field has decimals.

Leave a ReplyCancel reply