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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Dimitri70
Frequent Visitor

POwer BI Matrix visual and DAX formula to add new column

Hello

I am trying to summurize in a matrix visual for each of suppliers how many part are shared among different plants and how many parts are not. 

I have this raw data: 

Dimitri70_0-1711353274776.png

and below summary I would like to get in a matrix visual:

Dimitri70_3-1711353749961.png

Thank you for your support

 

 

1 ACCEPTED SOLUTION

Hi,

Here is one way to do this:

I modified the example data a bit.
Note that this would be easier if you have a dimension table for parts and plants instead of one table.

ValtteriN_0-1711357977096.png


Dax:

Plant Served Count = DISTINCTCOUNT('Table (29)'[Plant Served])

Part Shared =
//If material is found is mutiple locations we count it as 1 else 0
SUMX(
SUMMARIZE(
ADDCOLUMNS('Table (29)',"Materialtest",
IF(
var _material = [Material Code]
 var _supplier = [Supplier]
 RETURN
CALCULATE(DISTINCTCOUNT('Table (29)'[Plant Served]),ALL('Table (29)'),'Table (29)'[Material Code]=_material,'Table (29)'[Supplier]=_supplier)>1,1,0)),
'Table (29)'[Material Code],[Materialtest]),
[Materialtest])

Part not shared = DISTINCTCOUNT('Table (29)'[Material Code])-[Part Shared]


End result:

 ValtteriN_0-1711359780574.png

 

Here material code jkl is not considered as a shared part since it is only used in one factory.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
Gabry
Super User
Super User

What's you issue? You just need to make 3 measure with distinctcount like this:

 

Measure1= distinctcount(table(plant served))

Measure2= distinctcount(table(part shared))

 

then you put the supplier column and the measure in a matrix or table

Hello Gabry,

 

If I do as you suggest, I will get the total count of Material by plant but I would like to have separetely the count of material that are shared  to different plant.

Exampe material ABC from supplier 100 is common to plant A and B so resutl is 2, while DEF material from supplier 200 is commom to plants A B and C so the total is 3

Hi,

Here is one way to do this:

I modified the example data a bit.
Note that this would be easier if you have a dimension table for parts and plants instead of one table.

ValtteriN_0-1711357977096.png


Dax:

Plant Served Count = DISTINCTCOUNT('Table (29)'[Plant Served])

Part Shared =
//If material is found is mutiple locations we count it as 1 else 0
SUMX(
SUMMARIZE(
ADDCOLUMNS('Table (29)',"Materialtest",
IF(
var _material = [Material Code]
 var _supplier = [Supplier]
 RETURN
CALCULATE(DISTINCTCOUNT('Table (29)'[Plant Served]),ALL('Table (29)'),'Table (29)'[Material Code]=_material,'Table (29)'[Supplier]=_supplier)>1,1,0)),
'Table (29)'[Material Code],[Materialtest]),
[Materialtest])

Part not shared = DISTINCTCOUNT('Table (29)'[Material Code])-[Part Shared]


End result:

 ValtteriN_0-1711359780574.png

 

Here material code jkl is not considered as a shared part since it is only used in one factory.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/






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

Proud to be a Super User!




Thank you so much it works! 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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