資料表中的超連結Hyperlinks in tables

本主題將教導您如何使用 Power BI Desktop 建立超連結。This topic teaches you how to use Power BI Desktop to create hyperlinks. 建立之後,請使用 Desktop 或 Power BI 服務將這些超連結新增至您的報表資料表和矩陣中。Once created, use either Desktop or Power BI service to add those hyperlinks to your report tables and matrixes.

注意儀表板上的磚中的超連結和儀表板上的文字方塊可以使用 Power BI 服務即時建立。NOTE: Hyperlinks in tiles on dashboards and text boxes on dashboards can be created on-the-fly using Power BI service. 報表中的文字方塊中的超連結可以使用 Power BI 服務和 Power BI Desktop 即時建立。Hyperlinks in text boxes in reports can be created on-the-fly using Power BI service and Power BI Desktop.

在 Power BI Desktop 中可以建立資料表與矩陣內的超連結,而不是從 Power BI 服務中建立。Hyperlinks in tables and matrixes can be created in Power BI Desktop, but not from Power BI Service. 將活頁簿匯入 Power BI 之前,也可在 Excel Power Pivot 中建立超連結。Hyperlinks can also be created in Excel Power Pivot before the workbook is imported into Power BI. 以下說明這兩種方法。Both methods are described below.

新增超連結的程序取決於您是否已匯入資料,還是已使用 DirectQuery 連接資料。The procedure for adding a hyperlink depends on whether you've imported the data or connected to it using DirectQuery. 以下說明這兩種案例。Both scenarios are described below.

資料匯入 Power BIFor data imported into Power BI

  1. 如果超連結在資料集中未以欄位形式存在,請使用 Desktop 將其新增為自訂資料行If the hyperlink doesn't already exist as a field in your dataset, use Desktop to add it as a custom column.
  2. 在 [資料] 檢視中,選取資料行,且在 [模型] 索引標籤中選擇 [資料類別] 的下拉式清單。In Data view, select the column and in the Modeling tab choose the dropdown for Data Category.

  3. 選取 [Web URL] 。Select Web URL.
  4. 切換至 [報表] 檢視,並使用分類為 Web URL 的欄位建立資料表或矩陣。Switch to Report view and create a table or matrix using the field categorized as a Web URL. 超連結為藍色加底線。The hyperlinks will be blue and underlined.

  5. 如果您不想在表格中顯示完整的 URL,可以改為顯示超連結圖示 If you don't want to display a long URL in a table, you can display a hyperlink icon instead. 請注意,您無法在矩陣中顯示圖示。Note that you can't display icons in matrixes.

    • 選取要使用的圖表。Select the chart to make it active.
    • 選取油漆滾筒圖示來開啟 [格式化] 索引標籤。Select the paint roller icon to open the Formatting tab.
    • 展開 [值]、找到 URL 圖示並將它開啟Expand Values, locate URL icon and turn it to On.
  6. (選擇性) 將報表從 Desktop 發佈到 Power BI 服務,然後在 Power BI 服務中開啟報表。(Optional) Publish the report from Desktop to Power BI service and open the report in Power BI service. 超連結在該處也可以運作。The hyperlinks will work there as well.

使用 DirectQuery 連接資料For data connected with DirectQuery

您無法在 DirectQuery 模式中建立新的資料行。You won't be able to create a new column in DirectQuery mode. 但若資料已經包含 URL,您可以將它們轉換成超連結。But if your data already contains URLs, you can turn those into hyperlinks.

  1. 在 [報表] 檢視中,使用包含 URL 的欄位建立資料表。In Report view, create a table using a field that contains URLs.
  2. 選取該資料行,且在 [模型] 索引標籤中選擇 [資料類別] 的下拉式清單。Select the column, and in the Modeling tab, choose the dropdown for Data Category.
  3. 選取 [Web URL] 。Select Web URL. 超連結為藍色加底線。The hyperlinks will be blue and underlined.
  4. (選擇性) 將報表從 Desktop 發佈到 Power BI 服務,然後在 Power BI 服務中開啟報表。(Optional) Publish the report from Desktop to Power BI service and open the report in Power BI service. 超連結在該處也可以運作。The hyperlinks will work there as well.

將超連結新增至 Power BI 資料表和矩陣的另一種方式,是先在資料集內建立超連結,然後才從 Power BI 匯入/連線至該資料集。Another way to add hyperlinks to your Power BI tables and matrixes is to create the hyperlinks in the dataset before you import/connect to that dataset from Power BI. 這個範例會使用 Excel 活頁簿。This example uses an Excel workbook.

  1. 請在 Excel 中開啟活頁簿。Open the workbook in Excel.
  2. 選取 [PowerPivot] 索引標籤,然後選擇 [管理] 。Select the PowerPivot tab and then choose Manage.

  3. 當 PowerPivot 開啟時,選取 [進階] 索引標籤。When PowerPivot opens, select the Advanced tab.

  4. 將游標放在包含 URL 的資料行,其中的 URL 想要轉換成 Power BI 資料表中的超連結。Place your cursor in the column that contains the URLs that you'd like to turn into hyperlinks in Power BI tables.

    注意:URL 的開頭必須是 http:// 、https://wwwNOTE: The URLS must start with http:// , https:// or www.

  5. 在 [報表屬性] 群組中,選取 [資料類別目錄] 下拉式清單,然後選擇 [Web URL] 。In the Reporting Properties group, select the Data Category dropdown and choose Web URL.

  6. 從 Power BI 服務或 Power BI Desktop,連接至或匯入此活頁簿。From the Power BI service or Power BI Desktop, connect to or import this workbook.
  7. 建立包含 [URL] 欄位的資料表視覺效果。Create a table visualization that includes the URL field.

後續步驟Next steps

Power BI 報表的視覺效果Visualizations in Power BI reports

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

有其他問題嗎?More questions? 試試 Power BI 社群Try the Power BI Community