SKILL.md
唯讀
名稱
powerbi-modeling
描述
用於建立最佳化資料模型的 Power BI 語意模型化助理。適用於處理 Power BI 語意模型、建立量值、設計星狀結構 (star schema)、設定關聯性、實作 RLS 或最佳化模型效能。當詢問有關 DAX 計算、資料表關聯性、維度/事實資料表設計、命名規範、模型文件、基數、交叉篩選方向、計算群組以及資料模型最佳做法時觸發。提供指導前,一律先使用 power-bi-modeling MCP 工具連線至作用中的模型,以瞭解資料結構。
Power BI 語意模型化 (Power BI Semantic Modeling)
指導使用者遵循 Microsoft 最佳做法,建置最佳化且具備完善文件的 Power BI 語意模型。
何時使用此 Skill
當使用者詢問以下內容時使用此 skill:
- 建立或最佳化 Power BI 語意模型
- 設計星狀結構 (維度/事實資料表)
- 撰寫 DAX 量值或計算欄位
- 設定資料表關聯性 (基數、交叉篩選)
- 實作資料列層級安全性 (RLS)
- 資料表、欄位、量值的命名規範
- 為模型新增說明與文件
- 效能微調與最佳化
- 計算群組與欄位參數
- 模型驗證與最佳做法檢查
觸發關鍵字: "create a measure", "add relationship", "star schema", "optimize model", "DAX formula", "RLS", "naming convention", "model documentation", "cardinality", "cross-filter"
先決條件
必要工具
- Power BI Modeling MCP Server:連線與修改語意模型時所必需
- 支援:connection_operations、table_operations、measure_operations、relationship_operations 等
- 必須配置並執行,才能與模型互動
選用相依項目
- Microsoft Learn MCP Server:建議用於查詢最新最佳做法
- 支援:microsoft_docs_search、microsoft_docs_fetch
- 適用於複雜情境、新功能與官方文件檢索
工作流程
1. 先連線並進行分析
在提供任何模型化指導前,一律先檢查當前的模型狀態:
1. 列出連線:connection_operations(operation: "ListConnections")
2. 若無連線,檢查本機執行個體:connection_operations(operation: "ListLocalInstances")
3. 連線至模型 (Desktop 或 Fabric)
4. 取得模型總覽:model_operations(operation: "Get")
5. 列出資料表:table_operations(operation: "List")
6. 列出關聯性:relationship_operations(operation: "List")
7. 列出量值:measure_operations(operation: "List")
2. 評估模型健康度
連線後,依據最佳做法評估模型:
- 星狀結構 (Star Schema):資料表是否已正確分類為維度或事實?
- 關聯性:基數是否正確?雙向篩選是否已降至最低?
- 命名:是否採用易於理解且一致的命名規範?
- 文件說明:資料表、欄位、量值是否包含說明?
- 量值:關鍵計算是否使用明確量值 (Explicit Measures)?
- 隱藏欄位:技術性欄位是否已從報表檢視中隱藏?
3. 提供針對性指導
根據分析結果,參考以下內容指導改進:
- 星狀結構設計:參閱 STAR-SCHEMA.md
- 關聯性設定:參閱 RELATIONSHIPS.md
- DAX 量值與命名:參閱 MEASURES-DAX.md
- 效能最佳化:參閱 PERFORMANCE.md
- 資料列層級安全性:參閱 RLS.md
快速參考:模型品質檢查清單
| 領域 | 最佳做法 |
|---|---|
| 資料表 | 清晰區分維度與事實資料表分類 |
| 命名 | 易於理解:使用 Customer Name 而非 CUST_NM |
| 說明 | 為所有資料表、欄位、量值撰寫文件說明 |
| 量值 | 為業務指標編寫明確的 DAX 量值 |
| 關聯性 | 從維度到事實資料表建立一對多關聯 |
| 交叉篩選 | 除非特殊需求,否則保持單向篩選 |
| 隱藏欄位 | 從報表檢視中隱藏技術性金鑰與 ID |
| 日期表 | 專用且已標記的日期表 |
MCP 工具參考
使用以下 Power BI Modeling MCP 操作:
| 操作類別 | 關鍵操作 |
|---|---|
connection_operations |
Connect、ListConnections、ListLocalInstances、ConnectFabric |
model_operations |
Get、GetStats、ExportTMDL |
table_operations |
List、Get、Create、Update、GetSchema |
column_operations |
List、Get、Create、Update (descriptions、hidden、format) |
measure_operations |
List、Get、Create、Update、Move |
relationship_operations |
List、Get、Create、Update、Activate、Deactivate |
dax_query_operations |
Execute、Validate |
calculation_group_operations |
List、Create、Update |
security_role_operations |
List、Create、Update、GetEffectivePermissions |
常見任務
新增包含說明的量值
measure_operations(
operation: "Create",
definitions: [{
name: "Total Sales",
tableName: "Sales",
expression: "SUM(Sales[Amount])",
formatString: "$#,##0",
description: "Sum of all sales amounts"
}]
)
更新欄位說明
column_operations(
operation: "Update",
definitions: [{
tableName: "Customer",
name: "CustomerKey",
description: "Unique identifier for customer dimension",
isHidden: true
}]
)
建立關聯性
relationship_operations(
operation: "Create",
definitions: [{
fromTable: "Sales",
fromColumn: "CustomerKey",
toTable: "Customer",
toColumn: "CustomerKey",
crossFilteringBehavior: "OneDirection"
}]
)
何時使用 Microsoft Learn MCP
遇到以下情況時,可使用 microsoft_docs_search 查詢最新的最佳做法:
- 最新 DAX 函數文件
- Power BI 新功能與特性
- 複雜模型化情境 (如漸變維度 SCD Type 2、多對多關聯)
- 效能最佳化技巧
- 安全性實作模式






