Power BI 中的组合图(教程)Combo Chart in Power (Tutorial)

在 Power BI 中,组合图是将折线图和柱形图合并在一起的单个可视化效果。In Power BI, a combo chart is a single visualization that combines a line chart and a column chart. 通过将两个图表合并为一个图表可以进行更快的数据比较。Combining the 2 charts into one lets you make a quicker comparison of the data.

组合图可以具有一个或两个 Y 轴。Combo charts can have one or two Y axes.

何时使用组合图When to use a Combo Chart

组合图适用情况:Combo charts are a great choice:

  • 具有 X 轴相同的折线图和柱形图时。when you have a line chart and a column chart with the same X axis.
  • 比较具有不同值范围的多个度量值。to compare multiple measures with different value ranges.
  • 在一个可视化效果中说明两个度量值之间的关联。to illustrate the correlation between two measures in one visualization.
  • 检查一个度量值是否满足另一个度量值定义的目标to check whether one measure meet the target which is defined by another measure
  • 节省画布空间。to conserve canvas space.

创建基本的单轴组合图Create a basic, single-axis, Combo Chart

观看如何使用销售和市场营销示例创建组合图。Watch Will create a combo chart using the Sales and Marketing sample.

要创建自己的组合图,请登录到 Power BI,然后选择“获取数据> 示例 > 零售分析示例”。To create your own combo chart, sign in to Power BI and select Get Data > Samples > Retail Analysis Sample.

  1. 从“零售分析示例”仪表板中,选择总商店数磁贴以打开“零售分析示例”报表。From the "Retail Analysis Sample" dashboard, select the Total Stores tile to open the "Retail Analysis Sample" report.
  2. 选择编辑报表在编辑视图中打开报表。Select Edit Report to open the report in Editing View.
  3. 添加新报表页Add a new report page.
  4. 创建按月显示本年度销售额和毛利的组合图。Create a column chart that displays this year's sales and gross margin by month.

    a.a. 从“字段”窗格,选择销售额 > 本年度销售额 > From the Fields pane, select Sales > This Year Sales > Value.

    b.b. 销售额 > 本年度毛利拖动到框。Drag Sales > Gross Margin This Year to the Value well.

    c.c. 选择时间 > 会计月份以将它添加到框。Select Time > FiscalMonth to add it to the Axis well.

  5. 在可视化效果的右上角选择省略号 (...),然后选择“按会计月份排序”。Select the ellipses (...) in the upper-right corner of the visualization, and select Sort by FiscalMonth.
  6. 将柱形图转换为组合图。Convert the column chart to a combo chart. 在选择了柱形图的情况下,从“可视化效果”窗格中选择“折线和簇状柱形图”。With the column chart selected, from the Visualizations pane select the Line and clustered column chart.

  7. 字段窗格,将销售额 > 去年销售额拖动到行值存储段。From the Fields pane, drag Sales > Last Year Sales to the Line Values bucket.

    组合图应如下所示:Your combo chart should look something like this:

创建具有两个轴的组合图Create a combo chart with two axes

在此任务中,我们会比较毛利和销售额。In this task, we'll compare gross margin and sales.

  1. 按月份创建可跟踪去年毛利率的新折线图。Create a new line chart that tracks Gross Margin % last year by Month. 一月的 GM% 是 35%,在四月达到峰值 45%,在七月下降,在八月再次达到峰值。In January GM% was 35%, peaked at 45% in April, dropped in July and peaked again in August. 去年和本年度的销售额是否会呈现类似模式?Will we see a similar pattern in sales last year and this year?

  2. 本年度销售额 > 值去年销售额添加到折线图。Add This Year Sales > Value and Last Year Sales to the line chart. 去年 GM%的规模比销售额的规模小得多,这使比较难以进行。The scale of GM% Last Year is much smaller than the scale of Sales which makes it difficult to compare.

  3. 若要使视觉对象更易于查看和解释,请将折线图转换为折线和堆积柱形图。To make the visual easier to read and interpret, convert the line chart to a Line and Stacked Column chart.

  4. 去年毛利率列值拖动到行值中。Drag Gross Margin% Last Year from Column Values into Line Values. Power BI 会创建两个轴,从而允许数据集以不同方式缩放;左侧度量值是美元,右侧度量值是百分比。Power BI creates two axes, thus allowing the datasets to be scaled differently; the left measures dollars and the right measures percentage.

向轴添加标题Add titles to the axes

  1. 选择滚动油漆刷图标 ,打开格式窗格。Select the paint roller icon to open the Formatting pane.
  2. 选择向下箭头以展开 Y 轴选项。Select the down arrow to expand the Y-axis options.
  3. 对于 Y 轴(列),将“位置”设置为“”,将“标题”设置为“打开”,将“样式”设置为“仅显示标题”,并将“显示”设置为“百万”。For Y-Axis (Column), set Position to Left, set Title to On, Style to Show title only, and Display as Millions.

  4. Y 轴(列)下,同时确保将“显示辅助对象”设置为“打开”。Under Y-Axis (Column) also ensure that Show Secondary is set to On. 该操作显示对组合图的折线图部分进行格式化的选项。This displays options for formatting the line chart portion of the combo chart.

  5. 对于 Y 轴(行),将“位置”保留为“”,将“标题”设置为“打开”,并将“样式”设置为“仅显示标题”。For Y-Axis (Line), leave Position as Right, turn Title to On, and set Style to Show title only.

    组合图现在显示双轴,它们都具有标题。Your combo chart now displays dual axes, both with titles.

从这里你可能想要:From here you might want to:

突出显示和交叉筛选Highlighting and cross-filtering

有关使用筛选器窗格的信息,请参阅向报表添加筛选器For information about using the Filters pane, see Add a filter to a report.

突出显示组合图中的列或行可交叉筛选报表页上的其他可视化效果,反之亦然。Highlighting a column or line in a combo chart cross-filters the other visualizations on the report page... and vice versa.

后续步骤Next steps

向报表添加可视化效果Add a visualization to a report

Power BI 报表中的可视化效果Visualizations in Power BI reports

Power BI 中的可视化效果类型Visualization types in Power BI

Power BI - 基本概念Power BI - Basic Concepts

试用一下 - 完全免费!Try it out -- it's free!

更多问题?More questions? 尝试参与 Power BI 社区Try the Power BI Community