Forum Discussion
How to show a different chart based on selected value
Hi, let's say I have a table that looks similar to this:
| Site Name | Object A count | Object B count | Object C count |
| Site 1 | 10 | 12 | 14 |
| Site 2 | 5 | 7 | 9 |
I would like to display a pie chart or a bar graph showing the distribution of Object counts (A, B or C) based on Site Names. I would like to have some sort of slicer or equivalent where a user can select from A, B or C and display the chart with the selected column as the "y" value. So for example, selecting B would display a graph with the relationship between Site Name and Object B count, and then if I selected A or C, I would see the relationship again, but this time with the selected value column replacing the Object B count column. How can I use PowerBI to accomplish this?
2 Replies
- Sahir_MaharajSuper User
Hello Anonymous,
Create a new slicer visual and add the Object A count, Object B count, and Object C count columns to the slicer.
Create a new stacked column chart visual and add the Site Name column to the X-axis and all three object count columns (Object A count, Object B count, and Object C count) to the Values field.
- Filter type: Basic filter
- Field: Object A count (or Object B count, or Object C count)
- Operator: Is
- Value: (leave this blank)
Add a filter to the visual that filters the object count column based on the slicer selection. Create a new filter with the following settings:
Repeat this step for each of the three object count columns.
Let me know if you have any other questions.
- AnonymousNot applicable
I am having several problems with this:
1. After evaluating the data I've decided that a pie chart is best for this data, so the implementation must use a pie chart.
2. I can't add all the columns to one slicer, it gives me an error. I had to make a data unpivot table with all of the A, B, C attributes.3. However, when I select one of A, B or C, the graph does not change based on the selection.
4. Whenever I try to apply a filter to a visual, the "Apply filter" button is grayed out and I can't apply the filter.