Share via

CountRows expression appears multiple times within the group

Leonid Dynin 41 Reputation points
2022-09-23T20:48:49.347+00:00

I have a simple SSRS tablix with two fields - Age Bracket and # of deaths per age bracket (for particular condition). The report is grouped by Age Bracket and # of deaths is count of records per Age Bracket.

I'm using the following formula for # of deaths:

 CountRows("Age_Bracket")  

Here is the tablix in design mode:

244402-image.png

However, in Report Preview I see this (# of death appears multiple times per the same Age Bracket):

244347-image.png

How to eliminate duplicates, so the report will appear like this?

244441-image.png

SQL Server Reporting Services
SQL Server Reporting Services

A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.

0 comments No comments

Answer accepted by question author

Anonymous
2022-09-26T02:24:17.777+00:00

Hi @Leonid Dynin
You can open the Properties pane of Details in the grouping pane, add Group on [Age_Bracket], and you can achieve the result you want.
244604-1.png
Preview:
244605-2.png
Best regards,
Aniya

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Joyzhao-MSFT 15,651 Reputation points
    2022-09-26T02:24:38.1+00:00

    Hi @Leonid Dynin ,
    If you just need to count the number of deaths in each group, you can check the field - AddTotal, which will calculate the sum of all deaths in this group, and add an extra row;

    244538-01.png

    Then set the visibility of this Details Row , as shown below:

    244615-02.png
    244642-03.png

    If you want to count the number of rows, you can modify the expression to: =CountRows("Age_Bracket")
    If you are calculating the sum of deaths, use the SUM aggregate function.

    244651-04.png

    Preview:

    244632-05.png

    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.