Forum Discussion
Switch fields that are shown in chart based on slicer selection
Hello everyone,
I've got some data that looks like the following.
| Group | A_1 | A_2 | A_3 | B_1 | B_2 |
| A | 1 | 0 | 0 | 0 | 0 |
| A | 0 | 1 | 1 | 0 | 0 |
| A | 0 | 1 | 1 | 0 | 0 |
| A | 0 | 1 | 1 | 0 | 0 |
| A | 1 | 0 | 0 | 0 | 0 |
| A | 0 | 1 | 0 | 0 | 0 |
| B | 0 | 0 | 0 | 1 | 1 |
| B | 0 | 0 | 0 | 0 | 1 |
| B | 0 | 0 | 0 | 1 | 0 |
| B | 0 | 0 | 0 | 1 | 0 |
| B | 0 | 0 | 0 | 1 | 0 |
I'd like to have a chart and a slicer, whereby if the user selects Group A in the slicer, sum of columns A_1, A_2 and A_3 are shown in the chart. Likewise, if the user selects Group B from the slicer, sum of columns B_1 and B_2 are shown in the chart. The screenshots below illustrate the result I'd like to achieve.
Is this possible?
Thank you for any suggestions!
Hi,
In the Query Editor, right click on the first column and select "Unpivot other columns". Now create your chart.
6 Replies
- Ashish_Mathur
Super User
Hi,
In the Query Editor, right click on the first column and select "Unpivot other columns". Now create your chart.
- v-easonf-msft
Community Support
Hi, Anonymous
Ashish_Mathur ‘s solution seems to solve your problem well.
If your problem is solved, please mark his reply as a solution to close the thread, which will help more people who encounter similar problems.
Best Regards,
Community Support Team _ Eason- AnonymousNot applicable
Hi v-easonf-msft: In your screenshot above, A_1, A_2 and A_3 are still showing in the legend of the chart when you select Group B in the slicer. Is there a way to show only B_1 and B_2 when Group B is selected and show only A_1, A_2 and A_3 when Group A is selected?
- v-easonf-msft
Community Support
Hi, Anonymous
Currently Power BI cannot control the content displayed in the pie chart legend.
You can also consider creating a three-page report and replacing slicers with bookmarks.
Best Regards,
Community Support Team _ Eason