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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
V-pazhen-msft
Community Support
Community Support

@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
V-pazhen-msft
Community Support
Community Support

@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])

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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