Forum Discussion
Pir to switch or toggle between Type and Sub-type
Hi,
I am trying to getr a pie chart to switch or toggle. When a user selects one "Type" in a slicer, the pie should show "Sub-type". When they select "ALL", the pie should show "Type". The reason for this toggle is because there are too many sub-types when "ALL" is selected. Below link to a dummy re-creation - my method to do this was a distinct count of type. So when "All" is selected the count is >1, but it does not work!
Any ideas how to do this please, or where I went wrong in file below?
thanks
https://www.dropbox.com/s/rzn35c28jqufiv1/pie%20toggle%20example.pbix?dl=0
DavidWaters100 you should use bookmarks to achieve this
https://www.youtube.com/watch?v=_Afcj8mT5_Q
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
5 Replies
- parry2kSuper User
DavidWaters100 you should use bookmarks to achieve this
https://www.youtube.com/watch?v=_Afcj8mT5_Q
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
- negi007Community Champion
DavidWaters100you can achieve the desired result by using unpivot feature in power query window. In this way, you will have 3 columns one column which has numeric value, second column which will have main or sub-filter value, and 3rd column which will have all filter values. Below is the screenshot for your reference.
- amitchandakSuper User
DavidWaters100 , refer if this can help
Dynamically change chart axis in Power BI
https://www.youtube.com/watch?v=6jeSIRpjv0M - v-lili6-msftCommunity Support
"Type" and "Sub-type" are different dim fields, Slicer is just used to filter data, it could not switch between different dim field in a visual.
So as a workaround, you could unpivot "Type" and "Sub-type"column into one column, then use that column in a visual and use attribute column as a slicer to switch it.
https://radacad.com/pivot-and-unpivot-with-power-bi
Regards,
Lin
- DavidWaters100Post Patron
Thanks for your comments and replies. In the end I decided to duplicate my sheet and add a button to navigate to that duplicated sheet where "All" was pre-selected and the "Type" pie was showing. I added another button to return to the other sheet where user can choose a Type but not "All" - in this sheet the pie for "Sub-Type" is showing. Bit of a workaround but user just clicks on an "All" button or goes back to choose different Types, and the pie appears to switch like that.