Forum Discussion

mvmania's avatar
mvmania
Regular Visitor
9 years ago
Solved

Slicer by Column

Hi, I am very new to use Power BI. Thank you in advance for your answers.

I developed a table like below 

 

Project              Budget 2016               Budget 2017                  

Project1                1000                             1022

Project2                  1111                            1023

Project3               1112                               1032

...                             ...                                    ...

 

I would like to use slicer to show budget in 2016 and 2017 in one chart. In other words, if I click Budget 2016 in slicer, the chart shows information only based on data from column 'budget 2016', and if I click Budget 2017 in slicer, the chart shows that only based on data from column budget 2017.

Could you please let me know how? I am struggling with this for hours but to no avail.

Great thanks.

 

 

  • Go to the query editor, highlight both 2016 and 2017 columns (shift + mouse click), then click "unpivot columns" in the Transform tab. This will give you 2 columns: budget and year. Notice how your rows for project number have doubled, with a row for 2016 and a row for 2017. Now you can create a chart with the budget field for the value, and add a slicer with budget year as field that will filter the chart.

2 Replies

  • dkay84_PowerBI's avatar
    dkay84_PowerBI
    Icon for Microsoft Employee rankMicrosoft Employee
    Go to the query editor, highlight both 2016 and 2017 columns (shift + mouse click), then click "unpivot columns" in the Transform tab. This will give you 2 columns: budget and year. Notice how your rows for project number have doubled, with a row for 2016 and a row for 2017. Now you can create a chart with the budget field for the value, and add a slicer with budget year as field that will filter the chart.
    • mvmania's avatar
      mvmania
      Regular Visitor

      Thank you very much for this simple and great solution.

      You saved me!