向 Power BI 报表添加筛选器(在“编辑视图”中)Add a filter to a Power BI report (in Editing view)

“编辑视图”和“阅读视图”中报表筛选器的区别是什么What is the difference between report filters in Editing View versus Reading View

可使用下列两种模式与报表交互:阅读视图编辑视图There are two modes for interacting with reports: Reading View and Editing View. 而筛选功能会根据你所用的模式来提供。And the filtering capabilities available to you depend on which mode you're in.

  • 在“编辑视图”中,可以添加报表、页面和视觉对象筛选器。In Editing View, you can add report, page, and visual filters. 保存报表时,筛选器将随之一起保存。When you save the report, the filters are saved with it. 而在“阅读视图”中查看报表的人可以与你添加的筛选器交互,但不能保存他们所做的更改。People looking at the report in Reading View can interact with the filters you added, but not save their changes.
  • 在“阅读视图”中,可以与报表中已存在的任意报表、页面和视觉对象筛选器进行交互,但不能保存筛选器更改。In Reading View, you can interact with any report, page and visual filters that already exist in the report, but you won't be able to save your filter changes.

备注

本文介绍了如何在报表“编辑视图”中创建筛选器。This article describes how to create filters in report Editing View. 有关“阅读视图”中的筛选器的详细信息,请参阅 在报表“阅读视图”中与筛选器交互For more information on filters in Reading VIew, see interacting with filters in report Reading View.

视觉对象筛选器、页面筛选器、钻取筛选器和报表筛选器Visual filters, page filters, drillthrough filters, and report filters

“页面筛选器”可应用于报表页面上的所有视觉对象。A page filter applies to all the visuals on the report page. “视觉对象筛选器”可应用于报表页面上的单个视觉对象。A visual filter applies to a single visual on a report page. 报表筛选器应用于报表的所有页面。And a report filter applies to all pages in the report.

向特定可视化效果添加筛选器(又称视觉筛选器)Add a filter to a specific visualization (aka visual filter)

有两种方法可以实现此目的:There are 2 ways to do this:

  • 通过筛选可视化效果已在使用的字段by filtering a field that is already being used by the visualization
  • 通过标识可视化效果尚未使用的字段,并将该字段直接添加到“视觉级筛选器”存储桶中。by identifying a field that is not already being used by the visualization, and adding that field directly to the Visual level filters bucket.

通过筛选可视化效果中已有的字段By filtering the fields already in the visualization

  1. 在“编辑视图”中打开报表Open your report in Editing View.

  2. 打开“可视化效果和筛选器”窗格和“字段”窗格(如果尚未打开)。Open the Visualizations and Filters pane and the Fields pane (if they're not already open).

  3. 选择视觉对象,将其激活。Select a visual to make it active. 视觉对象使用的所有字段在“字段”窗格已标识并在“筛选器”窗格中列出来(在“视级筛选器”标题下方)。All the fields being used by the visual are identified in the Fields pane and also listed in the Filters pane, under the Visual level filters heading.

  4. 此时将向可视化效果已在使用的字段添加筛选器。At this point we'll add a filter to a field already being used by the visualization.

    • 向下滚动到“视觉对象级筛选器”区域,然后选择箭头以展开要筛选的字段。Scroll down to the Visual level filters area and select the arrow to expand the field you'd like to filter. 在本示例中,将筛选“StoreNumberName”In this example we'll filter StoreNumberName

    • 设置“基本”、“高级”或“前 N 个”筛选控件(请参阅如何使用报表筛选器)。Set either Basic, Advanced, or Top N filtering controls (see How to use report filters). 在本示例中,将选择“基本”筛选并在数值 10 、11 、15 和 18 旁放置选中标记。In this example we'll select Basic filtering and place checkmarks next to numbers 10, 11, 15, and 18.

    • 视觉对象会随新的筛选器而变化。The visual changes to reflect the new filter. 如果将报表与筛选器一起保存,则报表读者可以在“阅读视图”中通过选择或清除值的方式与筛选器交互。If you save your report with the filter, report readers can interact with the filter in Reading View, selecting or clearing values.

  5. 现在我们将一个全新的字段作为“视觉级筛选器”添加到可视化效果中。Now let's add a totally new field, as a Visual level filter, to our visualization.

    • 在“字段”窗格中,选择要添加为新视觉对象级筛选器的字段,然后将它拖到“视觉对象级筛选器”区域中。From the Fields pane, select the field you want to add as a new visual level filter, and drag it into the Visual level filters area. 在本示例中,我们将“区域经理”拖动到“视觉级筛选器”存储桶并仅选中“Andrew Ma”。In this example we'll drag District Manager into the Visual level filters bucket and select only Andrew Ma.

    • 请注意,“区域经理”添加到可视化效果本身。Notice that District Manager is not added to the visualization itself. 可视化效果仍由轴“StoreNumberName”和值“本年度销售额”组成。The visualization is still composed of StoreNumberName as the Axis and This Year Sales as the Value.

    • 此外,现在已将可视化效果本身筛选为仅显示 Andrew 本年度在指定商店的销售额。And, the visualization itself is now filtered to show only Andrew's sales this year for the specified stores.

向整个页面添加筛选器(又称页面视图筛选器)Add a filter to an entire page (aka page view filter)

  1. 在“编辑视图”中打开报表Open your report in Editing View.
  2. 打开“可视化效果和筛选器”窗格和“字段”窗格(如果尚未打开)。Open the Visualizations and Filters pane and the Fields pane (if they're not already open).
  3. 在“字段”窗格中,选择要添加为新页面级筛选器的字段,然后将它拖动到“页面级筛选器”区域中。From the Fields pane, select the field you want to add as a new page level filter, and drag it into the Page level filters area.
  4. 选择要筛选的值,设置“基本”或“高级”筛选控件(请参阅如何使用报表筛选器)。Select the values you want to filter and set either Basic or Advanced filtering controls (see How to use report filters).

    在此筛选器的影响下,将重新绘制页面上的所有可视化效果以反映更改。All the visualization on the page, impacted by this filter, are re-drawn to reflect the change.

如果将报表与筛选器一起保存,则报表读者可以在“阅读视图”中通过选择或清除值的方式与筛选器交互。If you save your report with the filter, report readers can interact with the filter in Reading View, selecting or clearing values.

添加钻取筛选器Add a drillthrough filter

通过在 Power BI 服务和 Power BI Desktop 中使用钻取,可以创建一个侧重于特定实体(如供应商、客户或制造商)的目标报表页。With drillthrough in Power BI service and Power BI Desktop, you can create a destination report page that focuses on a specific entity - such as a supplier, or customer, or manufacturer. 现在,从其他报表页中,用户可以右键单击该实体的数据点并钻取到已设定焦点的页。Now, from the other report pages, users can right-click on a data point for that entity and drillthrough to the focused page.

创建钻取筛选器Create a drillthrough filter

若要执行此操作,请在编辑视图中打开客户盈利率示例。To follow along, open the Customer Profitability sample in Editing view. 我们假设你需要一个侧重于管理层业务领域的页。Let's say that you want a page that focuses on Executive business areas.

  1. 向报表中添加一个新页,并将其命名为“管理人员团队”。Add a new page to the report and name it Team Executive. 这将是钻取目标页。This will be the drillthrough destination page.
  2. 添加可跟踪团队管理层业务领域的关键指标的可视化效果。Add visualizations that track key metrics for the team executives' business areas.
  3. 将“管理人员”>“管理人员名称”添加到钻取筛选器。Add Executive > Executive Name to the Drillthrough filters well.

    请注意,Power BI 向报表页添加了一个后退箭头。Notice that Power BI adds a back arrow to the report page. 选择后退箭头可使用户返回到初始报表页,即他们选择进行钻取时所在的页。Selecting the back arrow returns users to the originating report page -- the page they were on when they opted to drillthrough. 后退箭头仅在阅读视图中可用。The back arrow only works in Reading view.

使用钻取筛选器Use the drillthrough filter

让我们来看看钻取筛选器的工作原理。Let's see how the drillthrough filter works.

  1. 从“团队记分卡”报表页开始操作。Start on the Team Scorecard report page.
  2. 假设你是 Andrew Ma,并且你希望看到管理人员团队报表页仅筛选出你的数据。Let's say you're Andrew Ma and you want to see the Team Executive report page filtered to just your data. 从左上角区域图表中,右键单击任意绿色数据点打开钻取菜单选项。From the top-left area chart, right click any green data point to open the Drillthrough menu option.

  3. 选择“钻取”>“管理人员团队”钻取到名为“管理人员团队”的报表页。Select Drillthrough > Team Executive to drillthrough to the report page named Team Executive. 在你是 Andrew Ma 的情况下,对该页进行筛选以显示有关右键单击的数据点的相关信息。The page is filtered to show information about the data point from which you right-clicked; in this case Andrew Ma. 只有“钻取筛选器”框中的字段才会被传递到钻取报表页。Only the field that is in the Drillthrough filters well gets passed through to the drillthrough report page.

向整个报表添加筛选器(又称报表筛选器)Add a filter to an entire report (aka Report filter)

  1. 在“编辑视图”中打开报表Open your report in Editing View.
  2. 打开“可视化效果和筛选器”窗格和“字段”窗格(如果尚未打开)。Open the Visualizations and Filters pane and the Fields pane (if they're not already open).
  3. 在“字段”窗格中,选择要添加为新报表级筛选器的字段,然后将它拖动到“报表级筛选器”区域中。From the Fields pane, select the field you want to add as a new report level filter, and drag it into the Report level filters area.
  4. 选择要筛选的值(请参阅如何使用报表筛选器)。Select the values you want to filter (see How to use report filters).

活动页面上的视觉对象与报表中所有页面上的视觉对象都会随新的筛选器而变化。The visuals on the active page, and on all pages in the report, change to reflect the new filter. 如果将报表与筛选器一起保存,则报表读者可以在“阅读视图”中通过选择或清除值的方式与筛选器交互。If you save your report with the filter, report readers can interact with the filter in Reading View, selecting or clearing values.

  1. 选择后退箭头返回到上一个报表页。Select the back arrow to return to the previous report page.

故障排除Troubleshooting

为何你的视觉级筛选器与页面级筛选器会返回不同的结果Why your visual level filter and page level filter may return different results

当你添加视觉级筛选器时,Power BI 会筛选聚合结果。When you add a visual level filter, Power BI filters on the aggregated results. 默认聚合为“求和”,不过你也可以更改聚合类型The default aggregation is Sum, but you can change the aggregation type.

当你添加页面级筛选器时,Power BI 会筛选但不聚合。When you add a page level filter, Power BI filters without aggregating. 这是因为页面可能有多个视觉对象,而且每个视觉对象可能使用不同的聚合类型。It does this because a page can have many visuals which can each utilize different aggregation types. 因此,该筛选器会应用于每个数据行。So the filter is applied on each data row.

如果未看到“字段”窗格,请确保你处于报表编辑视图If you do not see the Fields pane, make sure you're in report Editing view

后续步骤Next steps

如何使用报表筛选器How to use report filters

报表中的筛选器和突出显示Filters and highlighting in reports

在报表的“阅读视图”中与筛选器和突出显示交互Interact with filters and highlighting in report Reading View

更改报表视觉对象相互交叉筛选和交叉突出显示的方式Change how report visuals cross-filter and cross-highlight each other

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