--- title: "PowerBI Desktop 集成" slug: "powerbi-desktop-integration" updated: 2026-10-22T18:01:51Z published: 2026-10-22T18:01:51Z canonical: "support.tulip.co/powerbi-desktop-integration" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # PowerBI Desktop 集成 *将 Tulip 表格与 PowerBI Desktop 集成,实现高效分析* [库页面链接](https://library.tulip.co/videos/powerbi-desktop-integration) ## 概述 此附带的 .pbix 模板演示了如何轻松将 Tulip 表数据导入[PowerBI](https://tulip.widen.net/content/efdxolfssc/original/tulip_library_powerquery_template.zip?u=a1yhpj&download=true)进行查询。[下载 PowerBI 模板](https://tulip.widen.net/content/efdxolfssc/original/tulip_library_powerquery_template.zip?u=a1yhpj&download=true) Tulip Analytics 在仅分析 Tulip 数据以及流式数据时表现更为出色。对于需要复杂数据模型、更长刷新频率和更广泛覆盖范围的分析,可采用此方法将 Tulip 数据呈现在领导者面前 ## PowerQuery 脚本 此外,请参阅下方 PowerBI 模板中包含的 PowerQuery 脚本```(TulipTableId as text, instance as text) as table=> letQuery = #table( type table [#"table" = text], { {TulipTableId}}), Function = Table.AddColumn(Query, "Offset", Number.Round(Json.Document(Web.Contents("https://"&instance&"/api/v3/tables/"& TulipTableId &"/count"))/100)), ExpandedOffset = Table.ExpandListColumn(Function, "Offset"), NbLoop = Number.Round(Json.Document(Web.Contents("https://" & instance & "/api/v3/tables/" & TulipTableId & "/count")) / 100), TableOffset = Table.FromList(List.Transform({0..NbLoop}, each Number.ToText(_*100))), TableOffset1 = Table.RenameColumns(TableOffset, {{"Column1", "Offset"}}), TulipTable = Table.AddColumn(TableOffset1, "Records", each Table.FromRecords(Json.Document(Web.Contents("https://" & instance & "/api/v3/tables/" & TulipTableId & "/records?limit=100&offset="& [Offset] &"&sortBy=_sequenceNumber&sortDir=asc")))) inTulipTable``` ## Power BI 服务集成 :::(信息) (注) 虽然上述脚本可在 Power BI Desktop 中正常运行,但在云端(Power BI 服务)中进行自动刷新时需要特别注意。为避免出现“动态数据源”错误,脚本必须在 Web.Contents 中使用 RelativePath 和 Query 函数。 这样,Power BI 就能将Tulip instance 识别为静态数据源的根 URL,从而在报告发布后支持定时刷新并安全管理 API 凭据。 ::: 请使用以下 Power Query (M) 脚本以确保与 Power BI Service 的兼容性: `(TulipTableId as text, instance as text) as table =>let BaseUrl = "https://" & instance, CountPath = "api/v3/tables/" & TulipTableId & "/count", NbRecords = Json.Document(Web.Contents(BaseUrl, [RelativePath = CountPath])), NbLoop = Number.RoundUp(NbRecords / 100), Offsets = List.Transform({0..NbLoop-1}, each _ * 100), TableOffset = Table.FromList(Offsets, Splitter.SplitByNothing(), {"Offset"}), TableOffset1 = Table.TransformColumnTypes(TableOffset, {{"Offset", type text}}), TulipTable = Table.AddColumn(TableOffset1, "Records", each let RecordsPath = "api/v3/tables/" & TulipTableId & "/records", Response = Json.Document( Web.Contents(BaseUrl, [ RelativePath = RecordsPath, Query = [ limit = "100", offset = [Offset], sortBy = "_sequenceNumber", sortDir = "asc" ] ]) ) in Table.FromRecords(Response) )in` *TulipTable本 Power BI 服务集成指南由 ATS 提供。* ## 操作说明 下载 .pbix 模板并按照应用内的说明操作(如下所示) 1. 在“主页 >>> 转换数据”部分查看模板化的 PowerQuery 以打开 PowerQuery 2. 查看“Tulip 查询”并将其中的 Tulip TableID 替换为所需的表 ID,将 instance 替换为实例 URL(例如:company.tulip.co) 3. 点击“调用”,并输入 API 凭据(使用“基本”身份验证) 4. 在系统提示时明确隐私级别(对于大多数用例,默认级别为“组织”) 5. 点击“记录”列右侧的分隔箭头 6. 根据需要修改表;点击“关闭并应用” ## 更多参考资料 - [microsoft.com/en-us/power-bi/transform-model/desktop-query-overview">PowerBI Desktop Support](https://learn.Microsoft Documentation on Dynamic Data Sources](https://learn.