在 Power BI Desktop 中使用內嵌階層標籤Use inline hierarchy labels in Power BI Desktop

Power BI Desktop 支援內嵌階層標籤,這是兩個階層式切入加強功能的其中一個。Power BI Desktop supports the use of inline hierarchy labels, which is the first of two features intended to enhance hierarchical drilling. 目前處於開發階段的第二個功能,能夠使用巢狀的階層標籤 (敬請期待,我們會經常更新)。The second feature, which is currently in development, is the ability to use nested hierarchy labels (stay tuned for that - our updates happen frequently).

內嵌階層標籤的運作方式How inline hierarchy labels work

有了內嵌階層標籤,使用 [全部展開] 功能展開視覺效果時,就可以查看階層標籤。With inline hierarchy labels, you can see hierarchy labels as you expand visuals using the Expand All feature. 查看這些階層標籤的一大好處是,展開您的階層式資料時,可以選擇依照不同階層標籤來排序One great benefit to seeing these hierarchy labels is that you can also choose to sort by these different hierarchy labels as you expand your hierarchical data.

使用內建的 [全部展開] 功能 (不含依階層標籤排序)Using the built-in Expand All feature (without sorting by hierarchy labels)

觀看內嵌階層標籤如何運作之前,讓我們先複習 [全部展開] 功能的預設行為。Before we see inline hierarchy labels in action, let's review how the default Expand All feature behavior. 這樣有助於我們了解內嵌階層標籤有多麼好用。Doing so will help us understand (and appreciate) how useful inline hierarchy labels can be.

下圖顯示年度銷售額的橫條圖視覺效果。The following image shows a bar chart visual for annual sales. 按一下滑鼠右鍵後,您可以選擇 全部展開When you right-click, you can choose Expand All.

選取 [全部展開] 之後,該視覺效果會展開從 [年] 至 [季] 的日期階層,如下圖所示。Once Expand All is selected, the visual expands the date hierarchy from Year to Quarter, as shown in the following image.

請注意,[年] 和 [季] 的標籤會一起顯示為內嵌...[全部展開] 時,這個標籤結構會延續至階層底部。Notice that the Year and Quarter labels are shown inline together... this labeling scheme continues as you Expand All down to the bottom of the hierarchy.

這是就是與具有 日期/時間 資料類型欄位相關聯的內建 [日期] 階層的運作方式。This is how the built-in Date hierarchy, associated with fields that have a date/time data type, behaves. 讓我們前往下一節,看看新的內嵌階層標籤功能有何不同。Let's head to the next section, and see how the new inline hierarchy labels feature is different.

使用內嵌階層標籤Using inline hierarchy labels

現在讓我們看看不同的圖表,其中使用的資料具有非正式的階層。Now let's look at a different chart - using data that has informal hierarchies. 在下列視覺效果中,我們有一個橫條圖,內容為 [銷售量],並使用 [色彩] 作為軸。In the following visual, we have a bar chart with Sales Amount, using Color as the axis. 在此資料中,[色彩] 和 [類別] 構成非正式的階層。In this data, Color and Class form an informal hierarchy. 從這裡,您可以再次選擇 [全部展開],向下切入階層。From here, you can again select Expand All to drill down into the hierarchy.

選取 [全部展開] 會以階層標籤的內嵌顯示下一個層級。Selecting Expand All shows the next level with the inline display of hierarchy labels. 根據預設,階層會依照量值排序,在此範例中為 [SalesAmount]。By default, inline hierarchies are sorted by the measure value – in this case, SalesAmount. 啟用內嵌階層標籤,您也可以選取右上角的省略符號 (...),然後選擇依階層排序此資料,然後選取 [排序依據] > [色彩類別],如下圖所示。With inline hierarchy labels enabled, you can choose to sort this data by the hierarchy too, by selecting the ellipses in the upper right corner (the ...), then selecting Sort By > Color Class as shown in the following image.

選取 [色彩類別] 之後,資料會依據選取的非正式階層排序,如下圖所示。Once Color Class is selected, the data is sorted based on the informal hierarchy selection, as shown in the following image.

注意

內嵌階層標籤功能還不允許依據值排序內建的時間階層,只能依照階層順序排序。The inline hierarchy label feature doesn't yet allow for the built-in time hierarchy to be sorted by value; it's only sorted by hierarchy order.

疑難排解Troubleshooting

您的視覺效果很可能會卡在展開的內嵌階層層級狀態中。It's possible for your visuals to get stuck in an expanded inline hierarchy level state. 在某些情況下,您可能會發現某些視覺效果會卡在展開的模式中,這樣就無法向上切入階層。In some cases, you might find that some of your visuals are stuck in the mode where they were expanded, in which case drilling up doesn't work. 如果您執行下列步驟,可能就會發生此情形 (解決方法是 下方 這些步驟):This can happen if you happened to take the following steps (the fix for this is below these steps):

可能造成視覺效果卡在展開狀態的步驟:Steps that might get your visuals stuck in an expanded state:

  1. 啟用內嵌階層標籤功能You enable the inline hierarchy label feature
  2. 您建立具有階層的視覺效果You create some visuals with hierarchies
  3. 然後 [全部展開] 並儲存檔案Then you Expand All and save your file
  4. 接著 停用 內嵌階層標籤 功能,並重新啟動 Power BI DesktopYou then disable the inline hierarchy label feature, and restart Power BI Desktop
  5. 然後重新開啟檔案Then you re-open your file

如果您不巧執行了這些步驟,而且視覺效果卡在展開的模式,您可以採取以下動作來針對這些錯誤進行疑難排解:If you happen to take those steps, and your visuals are stuck in expanded mode, you can do the following to troubleshoot them:

  1. 重新啟用內嵌階層標籤功能,並重新啟動 Power BI DesktopRe-enable the inline hierarchy label feature, then restart Power BI Desktop
  2. 重新開啟您的檔案,並向上切入至受影響的視覺效果頂端Re-open your file, and drill back up to top of your affected visual(s)
  3. 儲存檔案Save your file
  4. 停用內嵌階層標籤功能,然後重新啟動 Power BI DesktopDisable the inline hierarchy label feature, then restart Power BI Desktop
  5. 重新開啟檔案Re-open your file

或者,您可以刪除視覺效果再重新建立。Alternatively, you can just delete your visual and recreate it.