Search code examples
sqlreporting-servicesssrs-2008ssrs-tablix

Count expression in SSRS 2008


I have a situation where I have a column name `NotifcationLog.Status.

The status can be of 3 types Accepted, Pending & Overdue. I need to have a count of all the Notifications status .

I created a calculated field with the following expression

=COUNT(IIF(Fields!NotificationStatus.Value="Accepted",1,Nothing))

When I tried to add this Calculated field to the table and preview it , I got a error stating "aggregate ,row number,running value,previous and lookup functions cannot be used in calculated field expressions "

What should i do now ??


Solution

  • You try adding

     =IIF(Fields!NotificationStatus.Value="Accepted",1,0)
    

    as your calculated field. This returns back 1 or 0 depending on if the status is accepted.

    and then where you want to use it you can just SUM your calculated field to give you a count.

    =Sum(Fields!NewCalculatedField.Value)
    

    Use this in a table / matrix etc. where your data is grouped.