Forum Discussion
Pie Chart/Data Help
Hi, I am dealing with a data set that I am trying to make into charts in PowerBI that I can filter in real time. I want to make a chart based on columns C-F. I want a pie chart in which I can select a brand (i.e. Home Depot) and it will show me only the suppliers that are used by the brand. If there is a 1 in column C-F then that brand uses the corresponding supplier in column A. A zero in columns C-F means that brand does not leverage that supplier and therefore I do not want it to show up on the chart.
Is there a way to do this with the way the data is currently laid out? This is just a sample of a much larger data set so I am just curious if I can get these results with what I have.
2 Replies
- MFelixSuper User
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
- AnonymousNot 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