scapegoat17
scapegoat17

Reputation: 5841

SSRS Expression still returns a count for all fields

Would anyone be able to help me with my SSRS expression? It seems to be returning a count for all records even though I have certain requirements in my iif function.

Here is what I currently have:

=Count(Iif((Fields!METHOD.Value = "Something") AND (Fields!CATEGORIZATION.Value = "Incident") AND (Fields!SOURCE.Value = "Phone"), Fields!MONTH.Value = 1, 0))

The idea is to return a 1 and count it for each record that meets these requirements. If anyone needs me to elaborate any further, please let me know and I will edit/comment on your questions.

Upvotes: 0

Views: 199

Answers (1)

Ian Preston
Ian Preston

Reputation: 39586

As per the earlier comment, this should be a Sum and not Count - the latter simply counts the non-null values, so will always give the same result no matter what the IIf returns.

You also don't need Fields!MONTH.Value = 1 - just return either 1 or 0 in the IIf is enough:

=Sum(
  Iif(
    (Fields!METHOD.Value = "Something")
      AND (Fields!CATEGORIZATION.Value = "Incident")
      AND (Fields!SOURCE.Value = "Phone")
    , 1
    , 0
  )
)

Upvotes: 1

Related Questions