Use Power BI Slicer to Filter Columns

1.1k Views Asked by At

Dashboard View of Data

I would like to allow users to be able to filter the Power BI bar chart with the following options:

  1. GDP only (see only Country A, B, C GDP data only when GDP is selected on slicer)
  2. Population only
  3. GDP and Population

my current data structure(in excel) looks like this and it gets the job done but the duplication of the "Country" field seems inefficient: current data structure

is there a way to achieve the same 3 filtering options without duplicating the "Country" field? my ideal data structure is: ideal data structure

1

There are 1 best solutions below

1
On BEST ANSWER

Try this solution. First, create an additional table with all your option. I name this table as "support"

enter image description here

Second create measure

_GDP = CALCULATE(SUM(GDP_Population[GDP]),FILTER(GDP_Population, SELECTEDVALUE('support'[Option]) in {"Both","GDP"}))
_Population = CALCULATE(SUM(GDP_Population[Population]), FILTER(GDP_Population, SELECTEDVALUE('support'[Option]) in {"Both","Population"}))

and put it to your visual

enter image description here enter image description here