web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Counts and Total of a group

(0) ShareShare
ReportReport
Posted on by

I have the following table:

CustomerGroup Type Amount
10 B2B 10.00
10 B2C 20.00
20 B2B 100.00
20 B2B 200.00

I need to create a SSRS Report which contains consolidated data of the above

Count Customer Group Type Amount
1 10 B2B 10.00
1 10 B2C 20.00
2 20 B2B 300.00

I created a report where I "GROUPED BY" first by Customer Group and then by "Type". 

1. How do I get the count within a group. I used CountRows(CustomerGroup) but this does not count within the group. Can you please advise on what the expression should be so as to get the count within a group.

2. How to get total amount inside the group. I read that using "ADD TOTALS" will add a separate row outside the group having the total amount. But I do not a separate row. I need the total in the same row. Can you help me with the same?

Many thanks in advance.

I have the same question (0)
  • Martin Dráb Profile Picture
    235,968 Most Valuable Professional on at
    RE: Counts and Total of a group

    Can you elaborate your problem, please?

    Which row do you mean?

    Can you add a screenshot that shows groups? That's the crucial thing and it's completely missing from your picture.

  • Community Member Profile Picture
    on at
    RE: Counts and Total of a group

    2235.Untitled.png

    Can you tell where I am going wrong.

    The row seems to be repeating.

  • Verified answer
    Martin Dráb Profile Picture
    235,968 Most Valuable Professional on at
    RE: Counts and Total of a group

    Then you must remove grouping from the query. The report will receive individual records and it will group and aggregate them on its own.

  • Community Member Profile Picture
    on at
    RE: Counts and Total of a group

    If any queries defined via "Expression" can help achieve this, that would be my goal

  • Verified answer
    Martin Dráb Profile Picture
    235,968 Most Valuable Professional on at
    RE: Counts and Total of a group

    You must decide where you want to group the data - in the query or in the report. Currently you're grouping the query but then you're trying to use SSRS functions that would work if the report received ungrouped data.

    If you continue grouping the query, use the SUM aggregation function on Amount and COUNT to get the count.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 878 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 681 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 496 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans