在 Power BI 中深入探索可视化效果Drill down in a visualization in Power BI

向下钻取要求具有层次结构Drill down requires a hierarchy

视觉对象具有层次结构时,可以向下钻取以显示其他详细信息。When a visual has a hierarchy, you can drill down to reveal additional details. 例如,你可能有一个可视化效果,该可视化效果按由运动、专业和事件组成的层次结构查看奥运会奖牌数。For example, you might have a visualization that looks at Olympic medal count by a hierarchy made up of sport, discipline, and event. 默认情况下,可视化效果将按运动(体操、滑冰、水上项目等)显示奖牌数。但是因其具有层次结构,选择其中一个可视元素(如条形图、行或气泡图)将显示更多包含详细信息的图片。By default, the visualization would show medal count by sport -- gymnastics, skiing, aquatics, etc. But because it has a hierarchy, selecting one of the visual elements (such as a bar, line, or bubble), would display an increasingly more-detailed picture. 选择“水上运动”元素可以查看游泳、潜水和水球的数据。Select the aquatics element to see data for swimming, diving, and water polo. 选择“潜水”元素可以查看跳板、跳台和双人跳水活动项目的详细信息。Select the diving element to see details for springboard, platform, and synchronized diving events.

可以向你拥有的报表添加层次结构,但不能向与你共享的报表添加层次结构。You can add hierarchies to reports you own but not to those shared with you. 不确定哪个 Power BI 可视化效果包含层次结构?Not sure which Power BI visualizations contain a hierarchy? 将鼠标悬停在可视化效果上,如果在顶部边角看到这些钻取控件,则你的可视化效果具有层次结构。Hover over a visualization and if you see these drill controls in the top corners, your visualization has a hierarchy.

日期是层次结构的唯一类型。Dates are an unique type of hierarchy. 向可视化效果添加日期字段时,Power BI 自动添加包含年、季度、月和天的时间层次结构。When you add a date field to a visualization, Power BI automatically adds a time hierarchy that contains year, quarter, month, and day. 有关详细信息,请参阅视觉对象层次结构和向下钻取行为或观看下面的视频。For more information see Visual hierarchies and drill-down behavior or watch the video below.

备注

若要了解如何使用 Power BI Desktop 创建层次结构,请观看视频如何创建和添加层次结构To learn how to create hierarchies using Power BI Desktop, watch the video How to create and add hierarchies

向下钻取的两种方法Two methods to drill down

在可视化效果中向下(上)钻取有两种不同方法。There are two different way to drill down (and up) in your visualization. 本文中两种均有描述。Both are described in this article. 这两种方法完成同样的操作,因此请使用你最喜欢的任何一种。Both methods accomplish the same thing, so use whichever one you enjoy most.

备注

为此,打开 Power BI 服务中的打开零售分析示例并创建一个树图,该树图按区域城市邮政编码名称(组)显示本年度单位总数(值)。To follow along, open the Retail Analysis sample in Power BI service and create a treemap that looks at Total Units This Year (Values) by Territory, City, PostalCode, and Name (Group).

向下钻取的方法一Method 1 for drill down

此方法使用钻取图标,该图标显示在可视化效果本身的顶部边角。This method uses the drill icons that appear in the top corners of the visualization itself.

  1. 在 Power BI 中,以阅读视图或编辑视图打开报表。In Power BI, open a report in Reading view or Editing view. 钻取需要具有层次结构的可视化效果。Drill requires a visualization with a hierarchy.

    层次结构如下面的动画中所示。A hierarchy is shown in the animation below. 可视化效果具有一个由区域、城市、邮政编码和城市名称所组成的层次结构。The visualization has a hierarchy made up of territory, city, postal code, and city name. 每个区域均包含一个或多个城市,而每个城市均包含一个或多个邮政编码等。默认情况下,可视化效果仅显示区域数据,因为在列表中首先显示“区域”。Each territory has one or more cities, each city has one or more postal codes, etc. By default, the visualization displays only the territory data, because Territory appears first in the list.

  2. 若要启用钻取,选择可视化效果右上角的箭头图标。To enable drill down, select the arrow icon in the top right corner of the visualization. 当图标变成深色时,则钻取已启用。When the icon is dark, drill is enabled. 如果不打开钻取,则选择可视元素(如条形图或气泡图)将交叉筛选报表页上的其他图表。If you don't turn on drill, selecting a visual element (such as a bar or bubble) will cross-filter the other charts on the report page.

  3. 若要一次向下钻取一个字段,单击可视化效果中的其中一个元素,这在条形图中意味着单击其中一条,而在树状图中意味着单击其中一个树叶。To drill down one field at a time, click one of the elements in your visualization, in a bar chart this means clicking one of the bars and in a treemap, this means clicking one of the leaves. 请注意,标题随向下钻取和再次向上钻取而进行更改。Notice that the title changes as you drill down and back up again. 在此动画中,它从“按区域的本年度单位总数”更改为“按区域和城市的本年度单位总数”,更改为“按区域、城市和邮政编码的本年度单位总数”,更改为“按区域、城市、邮政编码和名称的本年度单位总数”。In this animation it changes from "Total Units This Year by Territory" to "Total Units This Year by Territory and City" to "Total Units This Year by Territory, City and PostalCode" to "Total Units This Year by Territory, City, PostalCode, and Name". 若要向上钻取,请选择可视化效果左上角的“向上钻取”图标 ,如下所示。And to drill back up, select the Drill Up icon in the top left corner of the visualization as shown below.

  4. 若要一次性向下钻取所有字段,请选择可视化效果左上角的双箭头。To drill down all fields at once, select the double arrow in the top left corner of the visualization.

  5. 若要向上钻取,请选择可视化效果左上角的向上箭头。To drill back up, select the up arrow in the top left corner of the visualization.

向下钻取的方法二Method 2 for drill down

此方法使用顶部 Power BI 菜单栏的“浏览”下拉列表。This method uses the Explore dropdown from the top Power BI menubar.

  1. 在 Power BI 中,以阅读视图或编辑视图打开报表。In Power BI, open a report in Reading view or Editing view. 钻取需要具有层次结构的可视化效果。Drill requires a visualization with a hierarchy.

    层次结构如下图所示。A hierarchy is shown in the image below. 可视化效果具有一个由区域、城市、邮政编码和城市名称所组成的层次结构。The visualization has a hierarchy made up of territory, city, postal code, and city name. 每个区域均包含一个或多个城市,而每个城市均包含一个或多个邮政编码等。默认情况下,可视化效果仅显示区域数据,因为在列表中首先显示“区域”。Each territory has one or more cities, each city has one or more postal codes, etc. By default, the visualization displays only the territory data, because Territory appears first in the list.

  2. 若要启用向下钻取,请选择可视化效果并将其激活,然后从 Power BI 顶部菜单栏选择“浏览” > “向下钻取”。To enable drill down, select a visualization to make it active and from the Power BI top menubar select Explore > Drill Down. 可视化效果右上角的钻取图标变为黑色背景。The drill-down icon in the top right corner of the visualization changes to a black background.

  3. 启用后,通过选择其中一个树状图树叶一次向下钻取一个字段。Once enabled, drill down one field at a time by selecting one of the treemap leaves. 在本示例中,我已选择名为“NC的区域,以按城市查看北卡罗来纳州本年度销售的单位总数。In this example, I've selected the territory named NC to see total units sold this year in North Carolina by city.

  4. 若要一次向下性钻取所有字段,请选择“浏览” > “显示下一级别”。To drill down all fields at once, select Explore > Show Next Level.

  5. 若要向上钻取,请选择“浏览” > “向上钻取”。To drill back up, select Explore > Drill Up.

  6. 若要查看用于创建视觉对象的数据,请选择查看数据To see the data being used to create the visual, select See data. 数据显示在视觉对象下方的窗格中。The data is displayed in a pane below the visual. 在视觉对象中继续进行钻取时,此窗格将保持不变。This pane remains as you continue drilling through the visual. 有关详细信息,请参阅显示所使用的数据以创建视觉对象For more information, see Show data used to create the visual.

注意事项和限制Considerations and limitations

  • 如果向可视化效果添加日期字段不会创建层次结构,则可能是因为“日期”字段实际上并未另存为日期。If adding a date field to a visualization does not create a hierarchy, it may be that the "date" field is not actually saved as a date. 如果拥有数据集,则在 Power BI Desktop 中的“数据”视图下打开,选择包含日期的列,然后在“建模”选项卡中将“数据类型”更改为“日期”或“日期/时间”。If you own the dataset, open it in Data view in Power BI Desktop, select the column that contains the date, and in the Modeling tab change the Data Type to Date or Date/Time. 如果已与你共享该报表,则与所有者联系以请求更改。If the report has been shared with you, contact the owner to request the change.

后续步骤Next steps

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

Power BI 报表Power BI reports

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

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