reporting-serviceswhere-clausessrs-expression

is there a way to write a where clause in ssrs?


I want to write a where clause that counts client ids where the sequence field is equal to 1. So in SQL it would be;

Count(clientid) WHERE sequence = 1.

But how do i write this in SSRS? I tried the following but it didn't work;

=Count(IIF(Fields!Sequence.Value = 1, Fields!ClientID.Value, 0))

Any idea where I am going wrong?

Thanks in advance


Solution

  • Looks like you might be able to get what you want with a fairly simple adjustment. Currently, you are using the COUNT function which I assume is simply counting each result that is generated. What you want is the SUM function. Try the following expression:

    =SUM(IIF(Fields!Sequence.Value = 1, 1, 0))