使用 Power BI 分析 Azure Data Lake 儲存體 Gen2 中的數據

在本文中,您將瞭解如何使用 Power BI Desktop 來分析和可視化儲存在具有階層命名空間的記憶體帳戶中的數據(Azure Data Lake 儲存體 Gen2)。

必要條件

開始本教學課程之前,您必須具備下列必要條件:

  • Azure 訂用帳戶。 移至取得 Azure 免費試用
  • 具有階層命名空間的記憶體帳戶。 請遵循建立記憶體帳戶以 建立記憶體帳戶中的指示來建立記憶體帳戶 。 本文假設您已建立名為的 contosoadlscdm記憶體帳戶。
  • 請確定您已獲授與記憶體帳戶的下列其中一個角色: Blob 數據讀取器Blob 數據參與者Blob 數據擁有者
  • 名為 Drivers.txt 的範例數據檔,位於您的記憶體帳戶中。 您可以從 Azure Data Lake Git 存放庫下載此範例,然後將該檔案上傳至您的記憶體帳戶。
  • Power BI Desktop。 您可以從 Microsoft 下載中心下載此應用程式

在 Power BI Desktop 中建立報表

  1. 在電腦上啟動Power BI Desktop。

  2. 請遵循 Azure Data Lake 儲存體 Gen2 連接器一文中的指示,連線數據。

  3. 從 Power Query Navigator 中,選取 [ 載入]。

    Screenshot of the Navigator, with data from the Drivers.txt file displayed.

  4. 成功將數據載入 Power BI 之後,下列欄位會顯示在 [ 字段 ] 面板中。

    Screenshot of the Fields panel, showing Query1, which contains Date accessed, Date created, Date modified, Extension, Folder Path, and Name fields.

    不過,若要可視化和分析數據,您可能會偏好使用下列字段來取得數據。

    Screenshot of a data table, with names and addresses from the Content column in the original table displayed in rows.

    在下一個步驟中,您將更新查詢,將匯入的數據轉換成所需的格式。

  5. 從功能區的 [ 首頁] 索引標籤中,選取 [ 轉換數據]。 然後,Power Query 編輯器隨即開啟,顯示檔案的內容。

    Screenshot of the Power Query editor, with the query created from the original Drivers.txt file.

  6. 在 Power Query 編輯器的 [內容] 資料行底下,選取 [二進位]。 檔案會自動偵測為 CSV,且將包含輸出,如下所示。 您的數據現在可以使用可用來建立視覺效果的格式。

    Screenshot of the Power Query editor, showing the data from the Binary field expanded to a table with names and addresses, with Imported CSV and Changed Type added to the Applied Steps panel.

  7. 從功能區的 [ 首頁] 索引標籤中,選取 [ 關閉及套用]。

    Closeup screenshot of the Power Query editor, showing the Close & Apply option.

  8. 更新查詢之後,[ 欄位 ] 索引標籤會顯示視覺效果可用的新欄位。

    Screenshot of the Fields pane in Power BI, with Query1 now displaying Column1 through Column8.

  9. 現在,您可以建立餅圖來代表指定國家/地區的每個城市中的驅動程式。 若要這樣做,請進行下列選擇。

    從 [ 視覺效果] 索引 標籤中,選取餅圖的符號。

    Screenshot of the Visualizations pane, with the pie chart symbol emphasized.

    在此範例中,您要使用的數據行為 Column 4(城市名稱)和數據行 7(國家/地區的名稱)。 將這些數據行從 [ 字段 ] 索引卷標拖曳到 [ 視覺效果] 索引標籤, 如下所示。

    Screenshot with Column4 dragged and dropped in Details and Column7 dragged and dropped in Values in the Visualization pane, and Column7 also dragged and dropped into Filters on this page in the Filters pane.

    餅圖現在應該類似下面所示的餅圖。

    Screenshot of pie chart showing the percentages of each slice of the pie, along with color coding of each of the locations, and a column containing all locations and their color code on the right side.

  10. 如果您從頁面層級篩選選取特定國家/地區,則會顯示所選國家/地區每個城市中的驅動程序數目。 例如,在 [視覺效果] 索引標籤的 [頁面層級篩選] 底下,選取 [巴西]。

    Screenshot of the Filters on this page pane, with Brazil selected as the country/region to display.

  11. 餅圖會自動更新,以顯示巴西城市的驅動程式。

    Screenshot of pie chart with the percentages of each slice of the pie for locations in Brazil, along with a list of all locations in Brazil and their color code in a column on the right side.

  12. 從 [ 檔案 ] 功能表中,選取 [ 儲存 ] 以將視覺效果儲存為 Power BI Desktop 檔案。

將報表發佈至 Power BI 服務

在 Power BI Desktop 中建立視覺效果之後,您可以將視覺效果發佈至 Power BI 服務,與其他人共用視覺效果。 如需如何執行此動作的指示,請移至 從 Power BI Desktop 發佈。

另請參閱