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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
AABright
Frequent Visitor

How do you display the total count of rows within each row of a matrix?

I am looking to create a matrix that looks like this.

The ID and Name fields have been selected from slicers. Now I need each row to display the total number of selected rows.

 

ID  Name Total Rows
12  AB   4
34  CD   4
56  EF   4
78  GH   4

 

This seems very simple. But any way I try to remove keep/remove context filters, the Total Rows just displays 1.

1 ACCEPTED SOLUTION
v-heq-msft
Community Support
Community Support

Hi @AABright ,
I’d like to acknowledge the valuable input provided by the @lbendlin . Their initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.
In my investigation, I took the following steps:
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1712197497776.png

Create a measure

Total Rows = CALCULATE(COUNTROWS(VALUES('Table'[ID])), ALLSELECTED('Table'))

Final output

vheqmsft_1-1712197559487.png

vheqmsft_2-1712197567532.png

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

5 REPLIES 5
v-heq-msft
Community Support
Community Support

Hi @AABright ,
I’d like to acknowledge the valuable input provided by the @lbendlin . Their initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.
In my investigation, I took the following steps:
Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_0-1712197497776.png

Create a measure

Total Rows = CALCULATE(COUNTROWS(VALUES('Table'[ID])), ALLSELECTED('Table'))

Final output

vheqmsft_1-1712197559487.png

vheqmsft_2-1712197567532.png

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

lbendlin
Super User
Super User

Try ALLSELECTED()

amustafa
Super User
Super User

OK, if that's what you want 🙂 See my sample.

 

Total Rows Count = CALCULATE(COUNTROWS(financials), ALL(financials))
 
amustafa_0-1712179328063.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amustafa
Super User
Super User

Hi @AABright , If you have a single table and looking to create a DAX measure to count rows for selected values from a slicer you can simply use something like this.

 

Total Rows = COUNTROWS(TableName)

 

For your specific question, please share your datamodel or sample data to be able to help you further. See this post.

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you for the suggestion @amustafa 

That produced the same result where the level of detail is applied to each row in the matrix - so it just counts 1.

In a card it displays the correct number. But I am trying to get 397 into each row, rather than 1.

countrows.png

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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