New to Telerik Reporting? Download free 30-day trial

How to Add a Counter Depending on a Column Value?

Environment

Product Progress® Telerik® Reporting

Description

I would like to add a total count depending on the value that I have in the "Category" field. I need to know how many Category = "A" and how many Category = "B" are there in the data.

Solution

You may utilize the Sum aggregate function, and pass it as an argument either 1 or 0, depending on the value of the field, e.g. 'Category'.

Here is a sample Expression that would return the count of the rows with Category = "A": = Sum(IIF(Fields.Category = "A", 1, 0)).

The Expression counts each 'A' Category value as 1 and the rest as 0, hence will return the number of A.

In this article