Power BI Desktop 中的数据源

使用 Power BI Desktop,你可以连接到来自许多不同的源的数据。 有关可用数据源的完整列表,请参阅 Power BI 数据源

若要查看可用的数据源,请在 Power BI Desktop 功能区的“主页”组中,选择“获取数据”按钮标签或向下箭头以打开“常用数据源”列表。 如果所需数据源未在“常用数据源”下列出,请选择“更多”以打开“获取数据”对话框。

Screenshot that shows the Get data item and the Common data types menu in Power BI Desktop.

或者,选择“获取数据”图标本身直接打开“获取数据”对话框。

Screenshot that shows the Get Data icon and the Get Data dialog box in Power BI Desktop.

注意

Power BI 团队正在不断扩展适用于 Power BI Desktop 和 Power BI 服务的数据源。 因此,你通常会看到工作过程中的数据源版本标记为 Beta预览。 标记为 Beta 或预览的任何数据源所提供的支持和功能有限,不应在生产环境中使用。 此外,任何标记为 Power BI Desktop Beta 或预览版的数据源在数据源正式发布 (GA) 之前可能都无法在 Power BI 服务或其他 Microsoft 服务中使用 。

数据源

“获取数据”对话框按以下类别组织数据类型:

  • 全部
  • 文件
  • 数据库
  • Microsoft Fabric(预览版)
  • Power Platform
  • Azure
  • Online Services
  • 其他

全部类别包括来自所有类别的所有数据连接类型。

文件数据源

文件类别提供下列数据连接:

  • Excel 工作簿
  • 文本/CSV
  • XML
  • JSON
  • 文件夹
  • PDF
  • Parquet
  • SharePoint 文件夹

数据库数据源

数据库类别提供下列数据连接:

  • SQL Server 数据库
  • Access 数据库
  • SQL Server Analysis Services 数据库
  • Oracle 数据库
  • IBM Db2 数据库
  • IBM Informix 数据库 (Beta)
  • IBM Netezza
  • MySQL 数据库
  • PostgreSQL 数据库
  • Sybase 数据库
  • Teradata 数据库
  • SAP HANA 数据库
  • SAP Business Warehouse 应用程序服务器
  • SAP Business Warehouse 消息服务器
  • Amazon Redshift
  • Impala
  • Google BigQuery
  • Google BigQuery (Microsoft Entra ID)(Beta)
  • Vertica
  • Snowflake
  • Essbase
  • AtScale 模型
  • Actian (Beta)
  • Amazon Athena
  • AtScale 多维数据集
  • BI 连接器
  • Data Virtuality LDW
  • Denodo
  • Exasol
  • Indexima
  • InterSystems IRIS (Beta)
  • Jethro (Beta)
  • Kyligence
  • Linkar PICK 样式/多值数据库 (Beta)
  • MariaDB
  • MarkLogic
  • MongoDB Atlas SQL (Beta)
  • TIBCO® 数据虚拟化
  • Dremio 软件
  • Dremio Cloud

注意

某些数据库连接器需要通过选择“文件”>“选项和设置”>“选项”,然后再选择“预览功能”才能启用。 如果你没有看到上面提到的某些连接器,但想使用它们,请检查“预览功能”设置。 另请注意,标记为 Beta 或预览的任何数据源所提供的支持和功能有限,不应在生产环境中使用。

Microsoft Fabric(预览版)

“Microsoft Fabric (预览版)”类别提供下列数据连接:

  • Power BI 语义模型
  • 数据流
  • 数据市场(预览版)
  • 仓库(预览版)
  • 湖屋(预览版)
  • KQL 数据库(预览版)

Power Platform 数据源

“Power 平台”类别提供下列数据连接:

  • Power BI 数据流(旧版)
  • Common Data Service(旧版)
  • Dataverse
  • 数据流

Azure 数据源

Azure 类别提供下列数据连接:

  • Azure SQL 数据库
  • Azure Synapse Analytics SQL
  • Azure Analysis Services 数据库
  • Azure Database for PostgreSQL
  • Azure Blob 存储
  • Azure 表存储
  • Azure Cosmos DB v1
  • Azure 数据资源管理器 (Kusto)
  • Azure Data Lake Storage Gen2
  • Azure Data Lake Storage Gen1
  • Azure HDInsight (HDFS)
  • Azure HDInsight Spark
  • HDInsight 交互式查询
  • Azure 成本管理
  • AKS Trino 上的 Azure HDInsight(Beta 版)
  • Azure Cosmos DB v2 (Beta)
  • Azure Databricks
  • Azure Synapse Analytics 工作区 (Beta)
  • Azure 时序见解 (Beta)
  • AKS Trino 上的 Azure HDInsight(Beta 版)
  • Azure Resource Graph(Beta 版)

联机服务数据源

Online Services 类别提供下列数据连接:

  • SharePoint Online 列表
  • Microsoft Exchange Online
  • Dynamics 365 Online(旧版)
  • Dynamics 365 (Dataverse)
  • Dynamics NAV
  • Dynamics 365 Business Central
  • Dynamics 365 Business Central (本地)
  • Azure DevOps(仅 Boards)
  • Azure DevOps Server(仅 Boards)
  • Salesforce 对象
  • Salesforce 报表
  • Google Analytics
  • Adobe Analytics
  • appFigures (Beta)
  • Data.World - 获取数据集 (Beta)
  • GitHub (Beta)
  • LinkedIn Sales Navigator (Beta)
  • Marketo (Beta)
  • Mixpanel (Beta)
  • Planview Portfolios
  • QuickBooks Online (Beta)
  • Smartsheet
  • SparkPost (Beta)
  • SweetIQ (Beta)
  • Planview Enterprise Architecture
  • Zendesk (Beta)
  • Asana (Beta)
  • Assemble Views
  • Autodesk Construction Cloud
  • Automation Anywhere
  • Automy Data Analytics (Beta)
  • CData Connect Cloud
  • Dynamics 365 Customer Insights (Beta)
  • Databricks
  • Digital Construction Works Insights
  • Emigo Data Source
  • Entersoft Business Suite (Beta)
  • eWay-CRM
  • FactSet Analytics
  • Palantir Foundry
  • 漏斗图
  • Hexagon PPM Smart® API
  • Industrial App Store
  • Intune 数据仓库 (Beta)
  • Planview OKR(Beta 版本)
  • Planview ProjectPlace
  • Product Insights (Beta)
  • Quickbase
  • SoftOne BI (Beta)
  • Planview IdeaPlace
  • TeamDesk (Beta)
  • Webtrends Analytics (Beta)
  • Witivio (Beta)
  • Zoho Creator
  • Profisee
  • Viva Insights

其他数据源

其他类别提供下列数据连接:

  • Web
  • SharePoint 列表
  • OData 数据源
  • Active Directory
  • Microsoft Exchange
  • Hadoop 文件 (HDFS)
  • Spark
  • Hive LLAP
  • R 脚本
  • Python 脚本
  • ODBC
  • OLE DB
  • Acterys:模型自动化与规划 (Beta)
  • Amazon OpenSearch Service (Beta)
  • Anaplan
  • 解算器
  • BitSight Security Ratings
  • BQE Core
  • Bloomberg 数据和分析
  • Celonis EMS (Beta)
  • Cherwell (Beta)
  • CloudBluePSA (Beta)
  • Cognite Data Fusion
  • 增量共享
  • Eduframe (Beta)
  • Emplifi 指标(Beta 版)
  • EQuIS
  • FactSet RMS (Beta)
  • FHIR
  • Google Sheets
  • Information Grid (Beta)
  • Jamf Pro (Beta)
  • Kognitwin
  • 适用于 Power BI 的 MicroStrategy
  • OpenSearch Project (Beta)
  • Paxata
  • QubolePresto (Beta)
  • Roamler (Beta)
  • SIS-CC SDMX (Beta)
  • Shortcuts Business Insights (Beta)
  • SingleStore Direct Query Connector 1.0 (Beta)
  • Siteimprove
  • Socialbakers Metrics 1.1.0 (Beta)
  • SolarWinds Service Desk(测试版)
  • Starburst Enterprise
  • SumTotal
  • SurveyMonkey
  • Microsoft Teams 个人分析 (Beta)
  • Tenforce (Smart)List
  • Usercube (Beta)
  • Vena
  • Vessel Insight
  • Wrike (Beta)
  • Zucchetti HR Infinity (Beta)
  • Bloomberg 数据和分析
  • Celonis EMS (Beta)
  • 空白查询

注意

此时,无法连接到使用 Microsoft Entra ID 保护的自定义数据源。

模板应用

选择“获取数据”窗口底部附近的“模板应用”链接后,可以查找组织的模板应用。

Screenshot that shows the Template Apps link in the Get Data dialog box.

可用模板应用可能因你的组织而异。

连接到数据源

  1. 若要连接到数据源,请从获取数据窗口选择数据源,然后选择连接。 以下屏幕截图显示已从“其他”数据连接类别中选择了“Web”。

    Screenshot that shows Web selected in the Other category in the Get Data dialog box.

  2. 此时会显示连接窗口。 输入 URL 或资源连接信息,然后选择“确定”。 以下屏幕截图显示已在“自 Web”连接对话框中输入 URL。

    Screenshot that shows a URL in the From Web dialog box.

  3. 系统可能会提示你提供凭据或其他信息,具体取决于数据连接。 提供所有必需信息后,Power BI Desktop 会连接到数据源,并在“导航器”对话框中显示可用数据源。

    Screenshot that shows the Navigator dialog box.

  4. 选择要加载的表和其他数据。 若要加载数据,请在“导航器”窗格底部选择“加载”按钮 。 若要在加载数据之前在 Power Query 编辑器中转换或编辑查询,请选择“转换数据”按钮。

这就是连接到 Power BI Desktop 中的数据源的所有相关信息。 尝试从我们不断增多的数据源列表连接到数据,并经常回访。 我们会持续将数据源添加到此列表中。

使用 PBIDS 文件获取数据

PBIDS 文件是具有特定结构的 Power BI Desktop 文件,并且具有 .PBIDS 扩展名,用于标识它是 Power BI 数据源文件。

可以创建 PBIDS 文件,用于简化组织中初次创建报表用户的“获取数据”体验。 如果从现有报表创建 PBIDS 文件,则初次创建报表的作者可以更容易地从同一数据生成新报表。

当作者打开 PBIDS 文件时,Power BI Desktop 将提示用户提供凭据,以进行身份验证并连接到文件指定的数据源。 此时将显示“导航器”对话框,用户必须从该数据源中选择要加载到模型中的表。 如果未在 PBIDS 文件中指定数据库和连接模式,用户可能还需要选择这两项。

之后,用户便可以开始生成可视化效果,或选择“最近使用的源”,将一组新的表加载到模型中。

目前,PBIDS 文件仅支持一个文件中的单个数据源。 指定多个数据源会导致错误。

如何创建 PBIDS 连接文件

如果现有的 Power BI Desktop PBIX 文件已连接到你感兴趣的数据,则可从 Power BI Desktop 中导出这些连接文件。 这是建议的方法,因为可以从 Desktop 自动生成 PBIDS 文件。 此外,也可以在文本编辑器中编辑或手动创建该文件。

  1. 若要创建 PBIDS 文件,请选择“文件”>“选项和设置”>“数据源设置”。

    Screenshot that shows selecting Data source settings under Options and settings.

  2. 在出现的对话框中,选择要导出为 PBIDS 文件的数据源,然后选择“导出 PBIDS”。

    Screenshot that shows the Data source settings dialog box.

  3. 在“另存为”对话框中,为文件命名,然后选择“保存”。 Power BI Desktop 将生成 PBIDS 文件,可以对其重命名和在目录中保存该文件,并与他人共享。

还可以在文本编辑器中打开该文件,然后进一步修改该文件,包括在文件本身指定连接模式。 下图显示了在文本编辑器中打开的 PBIDS 文件。

Screenshot that shows a PBIDS file open in a text editor.

如果希望在文本编辑器中手动创建 PBIDS 文件,则必须为单个连接指定所需的输入,并使用 .PBIDS 扩展名保存该文件。 此外,还可以选择将连接 mode 指定为 DirectQueryImport。 如果文件中缺少 mode 或者为 null,系统会提示在 Power BI Desktop 中打开文件的用户选择“DirectQuery”或“Import”。

重要

如果数据源中的列被加密,则某些数据源将生成错误。 例如,如果在导入操作期间对 Azure SQL 数据库中的两个或更多列进行了加密,则会返回一个错误。 有关详细信息,请参阅 SQL 数据库

PBIDS 文件示例

本节提供了一些来自常用数据源的示例。 PBIDS 文件类型仅支持在 Power BI Desktop 中同时支持的数据连接,但有以下例外:“Wiki URL”、“实时连接”和“空白查询”。

PBIDS 文件不包括身份验证信息以及表和架构信息。

以下代码片段显示了 PBIDS 文件的几个常见示例,但是它们并不完整,也不全面。 对于其他数据源,可以参阅协议和地址信息的 git 数据源引用 (DSR) 格式

如果你正在编辑或手动创建连接文件,则这些示例只是为了方便起见,并不全面,也不包含 DSR 格式的所有受支持的连接器。

Azure AS

{ 
    "version": "0.1", 
    "connections": [ 
    { 
        "details": { 
        "protocol": "analysis-services", 
        "address": { 
            "server": "server-here" 
        }, 
        } 
    } 
    ] 
}

文件夹

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "folder", 
        "address": { 
            "path": "folder-path-here" 
        } 
      } 
    } 
  ] 
} 

OData

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "odata", 
        "address": { 
            "url": "URL-here" 
        } 
      } 
    } 
  ] 
} 

SAP BW

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "sap-bw-olap", 
        "address": { 
          "server": "server-name-here", 
          "systemNumber": "system-number-here", 
          "clientId": "client-id-here" 
        }, 
      } 
    } 
  ] 
} 

SAP Hana

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "sap-hana-sql", 
        "address": { 
          "server": "server-name-here:port-here" 
        }, 
      } 
    } 
  ] 
} 

SharePoint 列表

URL 必须指向 SharePoint 站点本身,而不是站点内的列表。 用户将获取一个导航器,并用该导航器从该站点选择一个或多个列表,其中每个列表都成为模型中的一个表。

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "sharepoint-list", 
        "address": { 
          "url": "URL-here" 
        }, 
       } 
    } 
  ] 
} 

SQL Server

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "tds", 
        "address": { 
          "server": "server-name-here", 
          "database": "db-name-here (optional) "
        } 
      }, 
      "options": {}, 
      "mode": "DirectQuery" 
    } 
  ] 
} 

文本文件

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "file", 
        "address": { 
            "path": "path-here" 
        } 
      } 
    } 
  ] 
} 

Web

{ 
  "version": "0.1", 
  "connections": [ 
    { 
      "details": { 
        "protocol": "http", 
        "address": { 
            "url": "URL-here" 
        } 
      } 
    } 
  ] 
} 

数据流

{
  "version": "0.1",
  "connections": [
    {
      "details": {
        "protocol": "powerbi-dataflows",
        "address": {
          "workspace":"workspace id (Guid)",
          "dataflow":"optional dataflow id (Guid)",
          "entity":"optional entity name"
        }
       }
    }
  ]
}

可以使用 Power BI Desktop 执行各种操作。 有关其功能的详细信息,请参阅下列资源: