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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Get Count of columns in a matrix

Dear Community, 

I want to get count of column in below table,  the issue is that number of column in my tables changes based on a slicer, 
so I want to have every time when user select a filter on a slicer, I could get count of columns in updated table.
for example here is 4.
my goal is to find the rows those have blank cells to set the related variable to zero. 
Thanks in advance

MAx.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous  

Try set the context to the entire table with allselected().

Measure = Calculated(distinctcount(Table[Column]), Allselected(Table))

 


Paul Zheng _ Community Support Team

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Anonymous  

Try set the context to the entire table with allselected().

Measure = Calculated(distinctcount(Table[Column]), Allselected(Table))

 


Paul Zheng _ Community Support Team

 
amitchandak
Super User
Super User

@Anonymous , Use distinct count of the column

 

Example measure

distinctcount(Table[Column])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Thanks,
I tried it, but does not work, the problem is that for above table, distinctcount gave the result of 4 for first row,and result=4 for third row, 
and result=2 for second the row,
because it has null values, 
But I want to have result=4 for all rows, how can I handle this? 
how can I apply max function for whole matrix? 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors