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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors