Search code examples
powerbidaxpie-chartpowerbi-desktop

How to filter a Pie chart by selection in table


Please consider this scenario:

I have a table in Power-BI that's like this:

Country           Total Sales
-----------------------------
USA               2000
Canada            1400
Spain             3200

And I want to have a Pie chart in page that if user clicks on every rows, The pie shows sales type for that Country. For Example:

enter image description here

How can I connect these to visuals together?

Thanks


Solution

  • If the two visuals shows data from the same data source, then they will be "connected" by default, i.e. when the user clicks on a row in the table, the pie chart will show only the data from the selected country, and if the user clicks on a sector from the chart, the table will show only the amounts for this category.

    If you have a table in your data source like this:

    enter image description here

    Then add a table in the report with columns Country and Sales like this:

    enter image description here

    By default amounts will be aggregated as sum, so the table will show sum of Sales per Country. You can change the default summarization of the currently selected field in Modeling tab:

    enter image description here

    Add a pie chart with Category field in the legend and Sales field for value. Change the value to be shown as percentage from the grand total like this:

    enter image description here

    Adding Sales field as tooltip will also show the amount when pointing to a sector:

    enter image description here

    Now when you click on a row in the table, the pie chart will show only the relevant data:

    enter image description here

    For more information take a look at Change how visuals interact in a Power BI report and Filters and highlighting in Power BI reports articles.