三只貓
Rich Mindset Zone
richmindsetzone.com
← All posts

AI + BI 自動化:Power BI x Claude Code 嘅企業應用想像

AI + BI 自動化:Power BI x Claude Code 嘅企業應用想像

Power BI 嘅 API 一向出名封閉。你喺 Desktop 拉嚟拉去整到好靚嘅報表,背後嗰層 semantic model 根本冇 programmatic 入口。DAX 公式要靠人眼 debug,Row-Level Security 逐個 role 開嚟睇,measure 邏輯散落在十幾個 tab 之間。呢個困局仲要似乎係 Microsoft 刻意為之──BI 工具嘅主要客戶係業務分析師,唔係 developer。但當 Claude Code 呢類 AI coding agent 成熟到可以讀寫 Power BI 嘅內部模型嗰陣,成件事就唔同講法。

pbi-cli:打開 Power BI 嘅後門

MinaSaad1 開發嘅 pbi-cli 係呢個領域最直接嘅答案。佢用 Python.NET 做 in-process interop,直接由 Python 程序連入 Power BI Desktop 嘅 Tabular Object Model(TOM),做到 DAX 查詢執行、模型變更、measure 批次創建、TMDL 快照備份,全部喺 sub-second 完成。佢唔係靠咩 MCP server 或者 reverse engineering,而係直接食住 Microsoft 嘅分析服務客戶端 DLL。

更關鍵嘅係佢嘅「13 Skills」結構。每個 skill 都係一個 Claude Code 可以自動 call 嘅能力單元:DAX 查詢、Modeling、Deployment、Security、Diagnostics、Report 佈局、Visual 操作、Theme 管理。呢種設計意味住你唔使記 command,直接對 Claude 講「幫我開個 Executive Overview 頁,加個 bar chart 顯示 regional revenue Top 10」,佢就會自動行 pbi visual addpbi visual bindpbi filters add-topn 嚟完成。呢種 token-efficient 嘅設計特別適合 AI agent──每個 skill 都係 stateless command,唔使餵 half-screen 嘅 context 去解釋 Power BI 係乜。

到目前為止 pbi-cli 喺 PyPI 已經有過萬累計下載,GitHub 344 stars,仲有成 102 個 fork。數字唔算瘋狂,但佢代表嘅方向值得注意:將一個封閉 GUI 工具變成可編程嘅 AI agent playground。

金融機構嘅 AI 基建:Anthropic 嘅賭注

2026 年 5 月,Anthropic 一口氣推出 10 個金融服務 agent template,覆蓋 pitchbook 製作、KYC 審查、月結對數、估值審核、財務模型構建、盈餘電話分析等場景。唔係 PowerPoint demo,而係直接 deploy 去做 real work──Citadel、BNY、Carlyle、Walleye Capital 呢班機構已經用緊。FIS 更加話 AML 調查由幾日壓縮到幾分鐘。

背後支持呢啲 agent 嘅係一個龐大嘅 connector 網絡:FactSet、S&P Global、MSCI、PitchBook、Morningstar、Moody’s、Databricks、Snowflake……每個 connector 俾 Claude 經過 MCP 協議去 real-time 讀取金融數據,而且每個 output 都有 source link 可以追溯到原始資料。呢個架構解決咗金融 AI 嘅核心問題:trust。唔係靠 model 內部 knowledge,而係靠外部 verified data source。

呢個模式同 pbi-cli 嘅思路本質一樣:唔好靠 AI 自己「知道」啲乜,而要俾佢有能力去「攞」準確嘅 data。

BI 自動化嘅垂直場景

將呢兩件事拼埋,你會見到幾個具體嘅 automation 場景:

月結報告自動化。 今日好多 finance team 仲係用人手逐個 Excel cell 貼數字入 Power BI template。用 pbi-cli 嘅 semantic model layer,Claude Code 可以直接 query 最新嘅銷售數據、對比預算 variance、自動產生 commentary,再經 report layer 生出新一版 PBIR 報表。成個流程可以變成一個 Claude Managed Agent,每月底自動行一次。

Ad-hoc 分析 democratization。 非技術同事想睇「上個月邊個產品類別嘅毛利率跌咗超過 5%」,以前要開 ticket 等 BI team。而家可以直接用自然語言問 Claude,Claude 用 pbi-cli 行 DAX query,return 結果仲可以順手整張 visual。呢個先係真正嘅 self-service BI。

Compliance reporting。 銀行每日要出大量 regulatory report,每個數字都要有 audit trail。pbi-cli 嘅 TMDL snapshot 功能可以喺每次變更前自動 backup,Claude Code 可以 diff 兩個 snapshot 嘅差異,確保冇人改過 formula 而冇紀錄。Anthropic 嘅 KYC screener agent 仲可以自動檢查 entity 資料完整度,packaging escalation 俾 compliance team。

現實限制同 my take

講到尾,呢條路仲有障礙。pbi-cli 目前只支援 Windows 本地 Power BI Desktop,未 cover Power BI Service(雲端)。對於用緊 Power BI Premium 嘅大型企業,deployment agent 如果要改 production 嘅 semantic model,需要通過 XMLA endpoint,而 pbi-cli 目前嘅 TOM layer 係針對 Desktop 版。另外,Claude Code 本身需要 developer 級嘅操作環境,唔係個個 business analyst 用得順。

但我覺得呢啲係暫時嘅。pbi-cli 嘅架構本身就係 modular,加雲端 support 只係時間問題。Anthropic 嘅 Financial Services Solution 已經包含 Claude for Excel 同 PowerPoint,落 Power BI 只係 connector 數量嘅問題。

對於香港嘅科技創業者同開發者,我嘅建議係:而家就開始玩 pbi-cli。唔使等 Microsoft 官方出 CLI。呢類 open-source tool 嘅窗口期通常好短──一旦主流 vendor 注意到呢個 gap,佢哋會自己填返(睇下 Microsoft 最近點樣加速 Power BI 嘅 Git integration 就知)。但喺佢哋 fill 到之前,先用 pbi-cli 加 Claude Code 去解決你公司最痛嘅 BI 自動化問題。唔係為咗型,而係為咗你嘅 finance team 每月慳返個幾日。