Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Not applicable

M Code use aggregatetablecolumn

Hi all,


After unsuccesful googling, I'll try to find an answer here:


I have following data set 


I want to achieve a count on the activities per Case ID preferably in the query (M-code). So in more detail I want to have all distinct Case Id's and I want to count how many Activities happened for a certain case. I am not sure, but I think the aggregatetablecolumn might be useful in order to do this.


The result should look something like this:

Case ID:         Number Of Activities:

1                    10

2                    6

3                    1

and so on.


Can anyone help me with this?

Have a good one!




Super User
Super User


In power query, right-click on the case id column, select GROUP BY,  Choose CountRows





If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up

Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources


Fabric certifications survey

Certification feedback opportunity for the community.


Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors