You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PowerBI新手求助:如何将指定表格转换为堆叠条形图

Power BI新手友好版:宽表转堆叠条形图教程

Hey there! No worries at all—we all start somewhere with Power BI 😊. Let's walk through exactly how to turn your table into the stacked bar chart you want, step by step.

第一步:先把宽表转成长表(数据重塑)

Your current table is in a "wide" format (each question is a separate column), but stacked bar charts work best with "long" data. We'll fix this using Power Query:

  1. 打开Power Query编辑器
    • 在Power BI Desktop中,选中你的原始表格,点击顶部菜单栏的Transform data按钮,进入Power Query界面。
  2. 转置非ID列
    • 选中RespondentID列(按住左键点击列标题),右键点击它,选择Unpivot Other Columns。
    • 这一步会自动把所有Question列转成两行:Attribute(存储Question 1/2/3)和Value(存储对应的回答选项)。
  3. (可选但推荐)重命名列
    • 双击Attribute列标题,改成Question;双击Value列标题,改成Response——这样字段名更直观,后续操作不容易搞混。
  4. 保存更改
    • 点击Power Query左上角的Close & Apply,回到报表视图。

第二步:创建堆叠条形图

Now your data is ready! Let's build the chart:

  1. 选择可视化类型
    • 在右侧可视化面板里,找到并点击Stacked Bar Chart图标(就是那种横向的堆叠条形)。
  2. 配置字段
    • 把Question字段拖到Y轴区域(这会让左侧显示你的问题编号)。
    • 把Response字段拖到Legend区域(这会让不同的回答选项显示不同颜色)。
    • 把RespondentID字段拖到X轴区域,然后右键点击这个字段,选择Count(这样X轴就会显示每个选项的响应次数了)。

小优化建议(可选)

  • 调整颜色:点击可视化面板的Format选项卡,找到Colors,可以给Disagree、Agree、Neither设置你偏好的颜色,让图表更清晰。
  • 排序问题:如果Question的显示顺序不对(比如不是1→2→3),右键点击Question字段,选择Sort by Column→Sort by Name,就能按顺序排列了。
  • 显示数据标签:在Format选项卡中找到Data labels,打开它,就能看到每个堆叠块的具体计数,方便快速读取数据。

内容的提问来源于stack exchange,提问作者JDD

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 07:47:29