Search code examples
powerbipowerbi-desktoppowerbi-custom-visuals

How to get the following 100% Stacked bar chart in Power BI


I'm new to Power BI. I can plot a 100% stacked bar chart flawlessly in Plotly Python. However, when I tried to do the same thing on Power BI, I'm not succeeding.

The plot plot is here: stacked bar chart

The column names are x-labels, the stacks are unique values of the column, the y axis has the count of the stacks for each column.

What fields should I select for axis, legend, values, and tooltips to achieve the same in Power BI?

A snapshot of the data fields in BI is here:fields

All the 23 fields have the same five values: Strongly agree to Strongly disagree, as shown in the legend of the stacked bar chart.

A snapshot of the table. Each row is a survey response from a single respondent. table


Solution

  • Lets consider 5 column in your table for test purpose as below-

    enter image description here

    Now you need some transformation in your source data. Select All columns and apply Unpivot Columns from the ribbon's Transformation tab and you will get results as below-

    enter image description here

    Now get back to report by clicking Close & Apply button, and create this below measure-

    count_ = COUNT(your_table_name_1[Value])
    

    Finally configure your 100% Stacked Column Chart as below-

    enter image description here

    And here is the output (considering 5 questions)-

    enter image description here