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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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

v-nuoc-msft
Community Support
Community Support

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
v-nuoc-msft
Community Support
Community Support

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
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors