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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
reddysrujanredd
Regular Visitor

Number of rows in matrix visual

Hello everyone, I generated a power BI report in matrix visual, based on the expansion i need to display the total count in a card. If my visual contains 6 rows, befire expansion it should show 6 count, if i expanded one row, count should change depends upon the second level hierarchy rows. Like wise i have 3 levels. Main intention is to show the count to users before they export data. if they export data count should tally. Thanks in advance

 

2 ACCEPTED SOLUTIONS

Hi @reddysrujanredd 

Assuming I understood correctly, it is not possible to make the number displayed in a card change dynamically based on expanding or collapsing hierarchy levels in a matrix, because expansion does not affect the filter context in DAX.

If you want to display different subtotals based on the expanded level, here are some possible approaches:

Using built-in matrix subtotals – You can use the ISINSCOPE() function to detect the current hierarchy level and display the relevant count accordingly.
Using Field Parameters – You can create multiple measures for different hierarchy levels and let the user select the desired level via a slicer.

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Anonymous
Not applicable

Hi @reddysrujanredd 

 

As Ritaf1983 said, here are some details for your reference:

 

“Table”

vnuocmsft_0-1740032407761.png

 

Create a measure.

 

RowCount = 
SWITCH(
    TRUE(),
    ISINSCOPE('Table'[Name]), COUNTROWS(SUMMARIZE(ALL('Table'),'Table'[Name])),
    ISINSCOPE('Table'[Cno]), COUNTROWS(SUMMARIZE(ALL('Table'),'Table'[Cno])),
    ISINSCOPE('Table'[Lno]), COUNTROWS(SUMMARIZE(ALL('Table'),'Table'[Lno])),
    0
)

 

 Here is the result.

 

vnuocmsft_1-1740032588110.png

 

Regards,

Nono Chen

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

4 REPLIES 4
Anonymous
Not applicable

Hi @reddysrujanredd 

 

As Ritaf1983 said, here are some details for your reference:

 

“Table”

vnuocmsft_0-1740032407761.png

 

Create a measure.

 

RowCount = 
SWITCH(
    TRUE(),
    ISINSCOPE('Table'[Name]), COUNTROWS(SUMMARIZE(ALL('Table'),'Table'[Name])),
    ISINSCOPE('Table'[Cno]), COUNTROWS(SUMMARIZE(ALL('Table'),'Table'[Cno])),
    ISINSCOPE('Table'[Lno]), COUNTROWS(SUMMARIZE(ALL('Table'),'Table'[Lno])),
    0
)

 

 Here is the result.

 

vnuocmsft_1-1740032588110.png

 

Regards,

Nono Chen

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

 

Ritaf1983
Super User
Super User

Hi @reddysrujanredd 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi, Thanks for the response.Here is the sample data.

LnoCnoName
L1  
 C1 
  Name1
 C2 
  Name2
L2  
 c3 
  Name3
 c4 
  Name4

 Conut should show 4 if all the levels I expanded, when i export this data, I will get 4 rows. 

Hi @reddysrujanredd 

Assuming I understood correctly, it is not possible to make the number displayed in a card change dynamically based on expanding or collapsing hierarchy levels in a matrix, because expansion does not affect the filter context in DAX.

If you want to display different subtotals based on the expanded level, here are some possible approaches:

Using built-in matrix subtotals – You can use the ISINSCOPE() function to detect the current hierarchy level and display the relevant count accordingly.
Using Field Parameters – You can create multiple measures for different hierarchy levels and let the user select the desired level via a slicer.

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

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.