Power BI 服务中的切片器(教程)Slicers in Power BI service (Tutorial)

销售副总裁希望能够看一下整个部门以及每个单独的地区经理的多个指标。Your VP of Sales wants to be able to look at a number of metrics, for the entire division and for each individual District Manager. 她可以为每位经理创建单独的报表页,或者可以使用切片器。She could create a separate report page for each manager, or she could use a slicer. 切片器用于限制在页面的其他可视化效果中显示的部分数据集。A slicer narrows the portion of the dataset shown in the other visualizations on the page. 切片器是筛选的一种替代方法。Slicers are an alternate way of filtering.

何时使用切片器When to use a slicer

在以下情况下切片器是个不错的选择。Slicers are a great choice in the following situations.

  • 要在报表画布上显示常用或重要的筛选器以便访问数据。To display commonly-used or important filters on the report canvas for easier access.
  • 要更加轻松地查看当前筛选的状态,而无需打开下拉列表来查找筛选详细信息。To make it easier to see the current filtered state without having to open a drop-down list to find the filtering details.
  • 如果想要隐藏不需要的列,但是仍可以使用它们来筛选 - 这会使表格更小、更简洁。When you want to hide columns you don't need but still be able to use them to filter - this makes for narrower, cleaner tables.
  • 要创建更突出重点的报表 - 由于切片器是浮动对象,因此可将其放在报表中你希望用户关注的感兴趣的内容的旁边。To create more focused reports - since slicers are floating objects you can put them next to the interesting part of the report you want your users to focus on.

创建切片器Create a slicer

  1. 在“编辑视图”中打开 零售分析示例,然后 添加一个新的报表页Open the Retail Analysis Sample in Editing View and add a new report page.
  2. 从“字段”窗格中,选择地区 > 地区经理From the Fields pane, select District > District Manager.

  3. 将可视化效果转换为切片器。Convert the visualization to a slicer. 在“可视化效果”窗格中,选择切片器图标。In the Visualizations pane, select the slicer icon.

设置切片器格式Format the slicer

  1. 选择切片器后,在“可视化效果”窗格中选择滚筒刷图标 以显示格式选项。With the slicer selected, in the Visualizations pane, select the paint roller icon to display the Format options.
  2. 选择常规 > 边框颜色,然后选择深蓝色,并且将线条粗细更改为6Select General > Outline color and choose dark blue and change the Weight to 6.

  3. 默认情况下,在选择控制下方的全选关闭选择一个状态,为打开状态。Under Selection Controls, by default, Select All is Off and Single Select is On. 这意味着我需要使用 CTRL 键来一次选择多个姓名。This means that I have to use the CTRL key to select more than one name at a time. 全选设为打开选择一个设为关闭Turn Select All to On and Single Select to Off.

    • 请注意现在切片器的列表顶部有全选选项。Notice that the slicer now has a Select All option at the top of the list. 切换全选可以选择所有姓名或不选择任何姓名。Toggle Select All to select all of the names or to select none of the names.
    • 现在你无需使用 CTRL 键就可以选择多个姓名。And you can now select more than one name without having to use the CTRL key.
  4. 项目中,将文本大小增加到 14 pt。Under Items, increase the text size to 14pt. 我们想要确保同事能注意到此切片器。We want to be sure that our colleagues notice this slicer.
  5. 最后,将字体颜色设置为深红色。Lastly, set Font color to a dark red. 这样可以将切片器中已选定姓名和未选定的姓名区分开来。This will distinguish the selected names from the unselected names in our slicer.

  6. 尽情探索切片器的其他可用选项。Have fun exploring the other options available for slicers.

在报表中使用切片器Use the slicer in a report

  1. 将某些其他可视化效果添加到报表页,或打开零售分析示例报表,然后选择“地区每月销售额”选项卡。Add some additional visualizations to the report page or open the Retail Analysis sample report and select the District Monthly Sales tab.

  2. 针对 Carlos 划分报表页。Slice the report page for Carlos. 请注意其他可视化效果是如何更新以反映这些选择的。Notice how the other visualizations update to reflect these selections.

  3. 按地区经理姓氏的字母顺序对切片器进行排序。Sort the slicer alphabetically by District Manager last name. 选择切片器右上角的省略号 (...),然后选择地区经理Select the ellipses (...) in the top right corner of the slicer and choose District Manager.

控制切片器对页面上的其他视觉对象有何影响Control what effect the slicer has on other visuals on the page

是否希望切片器仅筛选出报表页上的部分视觉对象?Do you want the slicer to only filter some of the visuals on the report page? 使用视觉对象交互控件来对此进行设置。Use the Visual interactions control to set this up.

注意:如果看不到“视觉对象交互”,请改为查找其图标 NOTE: If you don't see Visual Interactions, look for its icon instead . 如果找不到这两者,请确保你处于报表编辑视图中。If you don't see either, make sure you are in report Editing view.

  1. 选择切片器使其处于活动状态,并从菜单栏中选择“视觉对象交互”。Select the slicer to make it active and, from the menu bar, choose Visual interactions.

  2. 筛选器控件将显示在页面上所有其他视觉对象上方。Filter controls will appear above all the other visuals on the page. 如果切片器要筛选一个视觉对象,请选择“筛选器”图标。If the slicer should filter a visual, select the Filter icon. 如果切片器不对视觉对象产生任何影响,请选择“无”图标。If the slicer should have no effect on the visual, select the None icon.

有关详细信息,请参阅 Visual interactions in a Power BI report(Power BI 报表中的视觉对象交互)For more information, see Visual interactions in a Power BI report.

Power BI 中有关切片器的注意事项和疑难解答Considerations and troubleshooting slicers in Power BI

使用 Power BI 中的切片器存在一些限制,如下所示:There are a few limitations to using slicers in Power BI, which are the following:

  1. 切片器不支持输入字段。Slicers do not support input fields.
  2. 单个切片器不能用于整个报表。A single slicer cannot be used across an entire report. 切片器只会影响当前页。A slicer only impacts the current page.
  3. 切片器不能固定到仪表板。Slicers cannot be pinned to a dashboard.
  4. 切片器不支持明细。Drilldown is not supported for slicers.
  5. 切片器不支持视觉对象级别的筛选器。Slicers do not support Visual level filters.

你有关于如何改进 Power BI 的想法吗?Do you have ideas for how to improve Power BI? 提交想法Submit an idea.

后续步骤Next steps

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

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