简体   繁体   English

如何在 Power BI 中获得以下 100% 堆叠条形图

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

I'm new to Power BI.我是 Power BI 的新手。 I can plot a 100% stacked bar chart flawlessly in Plotly Python.我可以在 Plotly Python 中完美地绘制 100% 堆积条形图。 However, when I tried to do the same thing on Power BI, I'm not succeeding.但是,当我尝试在 Power BI 上做同样的事情时,我没有成功。

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.列名是 x 标签,堆栈是列的唯一值,y 轴是每列的堆栈计数。

What fields should I select for axis, legend, values, and tooltips to achieve the same in Power BI?我应该为轴、图例、值和工具提示选择哪些字段以在 Power BI 中实现相同的目标?

A snapshot of the data fields in BI is here: fields BI 中数据字段的快照如下:字段

All the 23 fields have the same five values: Strongly agree to Strongly disagree, as shown in the legend of the stacked bar chart.所有 23 个字段都具有相同的五个值: 非常同意 非常不同意,如堆积条形图的图例所示。

A snapshot of the table.表的快照。 Each row is a survey response from a single respondent.每行是来自单个受访者的调查回复。 table桌子

Lets consider 5 column in your table for test purpose as below-让我们考虑表中的 5 列以进行测试,如下所示-

在此处输入图片说明

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-选择所有列并从功能区的转换选项卡应用逆透视列,您将获得如下结果-

在此处输入图片说明

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-最后配置您的 100% 堆积柱形图如下-

在此处输入图片说明

And here is the output ( considering 5 questions )-这里是(考虑5个问题)的输出-

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM