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

Count The Number of subcategories in matrix

I want to count the number of subcategories. Data looks like below:

 

 

Rank     			Vendor Group
Elite	       		Avot
Elite	           	Ivak
Essential			Boch LTD
Essential			Futh Elec
Provisional			Active Dach
Provisional			Alloc Mac
Provisional			Alldoc
Provisional			Anpro
Provisional			Falow
Provisional			Match
Provisional			Beast Elec

 

 

The data above is a matrix. Vendor group is a column that comes from Vendor Info Table and Rank is a measure calculated based on their score calculated using another measure. I want to count how many Elites and how many Provissonals we have in different card or table. How can I do this please?

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

First create a dim table as below:

v-kelly-msft_0-1621411919932.png

Then create a measure as below:

Measure 2 = 
SWITCH(SELECTEDVALUE('Dim table'[Column1]),"Elite",CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Measure]="Elite")),
"Essential",CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Measure]="Essential")),
"Provisional",CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Measure]="Provisional")))

Finally you will see:

v-kelly-msft_1-1621411964645.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Surafel_0-1620258346644.png

I am only getting the total number of vendor groups as shown in snippet above. 

Hi @Anonymous ,

 

First create a dim table as below:

v-kelly-msft_0-1621411919932.png

Then create a measure as below:

Measure 2 = 
SWITCH(SELECTEDVALUE('Dim table'[Column1]),"Elite",CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Measure]="Elite")),
"Essential",CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Measure]="Essential")),
"Provisional",CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Measure]="Provisional")))

Finally you will see:

v-kelly-msft_1-1621411964645.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

samdthompson
Memorable Member
Memorable Member

Hello, try making this measure:

 

=COUNTROWS(Table)

 

here it is at work:

2021-05-06_11-34-15.jpg

// if this is a solution please mark as such. Kudos always appreciated.

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.