cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msprog
Helper I
Helper I

Totals on Matrix visual

Hi 

I am looking at the Matrix visual in PBI .

I have a dataset like this ,  This is sample mockup dataset, but the business could put a product into mutiple categories

for e,g Product1 can belong to Cat1 and Cat2

 

msprog_0-1669852094390.png

I would like this in a matrix visual with the distinct counts for each category. Plus a grand Total 

 

msprog_1-1669852239356.png

For some reason the total is coming as 6 when it should have been 12. 

Any pointers to how this could be achieved please

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @msprog ,

 

You can create a measure as 

Count of Product = var _tab=SUMMARIZE('Table',[Category],"count",DISTINCTCOUNT('Table'[Product]))
return SUMX(_tab,[count])

vstephenmsft_0-1672122437556.png

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @msprog ,

 

You can create a measure as 

Count of Product = var _tab=SUMMARIZE('Table',[Category],"count",DISTINCTCOUNT('Table'[Product]))
return SUMX(_tab,[count])

vstephenmsft_0-1672122437556.png

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Shahfaisal
Solution Sage
Solution Sage

If you create a calculated column by concatenating Category and Product, and then create a distinct count measure using this column, would that give you what you are looking for?

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

Thank you 2022 Review

2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.