Forum Discussion
Pie Chart/Data Help
Hi Anonymous ,
Create a table with the following data:
| Brands |
| AA |
| BB |
| CC |
| DD |
Replace by your brands name then add the following measure to use on your chart:
Pie chart suppliers =
IF (
COUNT ( Brands[Brands] ) <> 1;
"Select only one category";
SWITCH (
TRUE ();
SELECTEDVALUE ( Brands[Brands] ) = "AA"; CALCULATE ( COUNT ( Suppliers[AA] ); Suppliers[AA] = 1 );
SELECTEDVALUE ( Brands[Brands] ) = "BB"; CALCULATE ( COUNT ( Suppliers[AA] ); Suppliers[BB] = 1 );
SELECTEDVALUE ( Brands[Brands] ) = "CC"; CALCULATE ( COUNT ( Suppliers[AA] ); Suppliers[CC] = 1 );
SELECTEDVALUE ( Brands[Brands] ) = "DD"; CALCULATE ( COUNT ( Suppliers[AA] ); Suppliers[DD] = 1 );
0
)
)
Use the Brands table as a slicer and check result below:
Another option would be to unpivot on the brands columsn and then use the new column to make the slicer.
Regards,
MFelix
- Anonymous7 years agoNot applicable
Hi, thanks for the info! I am still having some trouble however.... I am newer to powerBI
The screenshot above is an example of a spreadsheet I am importing from excel. When you say to add a new table do you mean in excel or within PowerBI? Could you maybe show what you have in the fields column?
Also, could you explain how you added the formula to the pie chart specifically? I clicked "New Measure" but I am not sure if that is correct.
Thank you so much for your help!
JP