Skip to content
Back to skills

Pbi Model

ASecurity

Bring data into Power BI and model it: Power Query / M connections and transforms, star schema and date table, relationships, DAX measures and calculated columns in TMDL, naming and performance, and writing measures safely (TMDL when the .pbip is closed, TOM only to try formulas). Use when: connect a source, fix types or query folding, design fact/dimension tables, add or fix a measure, relationship or date table, tune DAX. Not: business discovery or project documents -> data-discovery; query...

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 4, 2026
ai-agentsgosqlapiperformance

Works with

  • api
  • mcp

Security analysis

A100/100

Pro scans all 19 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add OPC-VN/agent-data-studio --skill pbi-model --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pbi Model?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pbi Model
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/opc-vn-pbi-model/badge)](https://www.skillsdirectory.com/skills/opc-vn-pbi-model)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pbi-model
description: "Bring data into Power BI and model it: Power Query / M connections and transforms, star schema and date table, relationships, DAX measures and calculated columns in TMDL, naming and performance, and writing measures safely (TMDL when the .pbip is closed, TOM only to try formulas). Use when: connect a source, fix types or query folding, design fact/dimension tables, add or fix a measure, relationship or date table, tune DAX. Not: business discovery or project documents -> data-discovery; querying or exploring data under the safety policy -> pbi-analysis; report pages and visuals -> pbi-design / pbi-build; reviewing an existing model -> pbi-review; deploying to Fabric -> pbi-publish."
metadata:
  group: powerbi
  chain_position: 2
  status: stable
  sources:
    - "agent-data-studio: model design and measure-writing practice"
    - "microsoft: plugins/powerbi-authoring/skills/semantic-model-authoring/references/*@v0.3.16 (verbatim, not yet distilled)"
---

# pbi-model — đưa dữ liệu vào & mô hình hoá

## Mục đích
Biến nguồn dữ liệu thành semantic model đúng và nhanh: Power Query/M → star schema + date table →
measure DAX có tên, định dạng, thư mục. Ghi measure sao cho **không mất khi user lưu file**.

## Trước / Sau trong chuỗi

| | Skill | Khi nào |
|---|---|---|
| Trước | [`data-discovery`](../data-discovery/SKILL.md) | Đã có PROJECT.md, DATA_DICTIONARY, METRICS_CALCULATION |
| Trước (nhánh) | [`data-mockup`](../data-mockup/SKILL.md) | Chưa có dữ liệu thật → dùng bộ mẫu |
| Sau | [`pbi-analysis`](../pbi-analysis/SKILL.md) | Model chốt → truy vấn/khai thác, soát số |
| Liên quan | [`pbi-review`](../pbi-review/SKILL.md) · [`pbi-knowledge`](../pbi-knowledge/SKILL.md) | Review model · ghi bài học |

Chuỗi đầy đủ: `workflows/data-to-report.md` ở gốc repo.

## Bắt buộc / Ưu tiên / Tránh
- **Bắt buộc** — PBIP-first: đầu dự án bảo user *Save As* `.pbip` (bật preview PBIP + PBIR) để model là TMDL text.
- **Bắt buộc** — thứ tự: kết nối → transform → model → measure. Không viết measure khi model chưa chốt.
- **Bắt buộc** — mỗi bước một cổng kiểm **chạy được** (bảng dưới); không có bằng chứng = chưa xong.
- **Bắt buộc** — lưu measure bền bằng **TMDL khi file đóng**; TOM không làm file dirty → Ctrl+S không cứu.
- **Bắt buộc** — đường dẫn nguồn là **M parameter**; credential không bao giờ nằm trong M.
- **Ưu tiên** — fold tối đa về nguồn; biến đổi nặng ở Power Query/SQL, tính theo ngữ cảnh báo cáo ở DAX.
- **Ưu tiên** — measure gom một bảng riêng (vd `Công Thức`), `displayFolder` theo trang báo cáo, `formatString` tường minh.
- **Ưu tiên** — `VAR`, `DIVIDE`, time-intelligence lọc qua date table.
- **Ưu tiên** — sau khi đưa công thức, giải thích **vì sao** chọn cách đó (không chỉ dán mã) để người dùng tự làm được lần sau.
- **Tránh** — auto date/time; quan hệ hai chiều không lý do; `SUM` cột tồn/số dư qua nhiều kỳ.
- **Tránh** — interleave ghi từ hai MCP (bridge studio + Modeling MCP Microsoft) lên cùng model.
- **Tránh** — TMSL `createOrReplace` mức từng measure qua ADOMD (Desktop từ chối).

## Quy trình (mỗi bước có cổng)

| # | Bước | Đọc | Cổng kiểm |
|---|---|---|---|
| 1 | **Kết nối** — sửa partition M trong TMDL hoặc hướng dẫn *Get Data* khi nguồn cần credential UI | [m-best-practices](references/kpim/m-best-practices.md) · [sql-best-practices](references/kpim/sql-best-practices.md) · MS [connection-binding](references/microsoft/connection-binding.md) | Refresh thành công; `EVALUATE ROW("n", COUNTROWS('Bảng'))` khớp kỳ vọng |
| 2 | **Transform M** — staging tách query cuối, tên bước rõ nghĩa, ép kiểu tường minh ở cuối (nhất là Date) | [m-best-practices](references/kpim/m-best-practices.md) · [gotchas](references/kpim/gotchas.md) | `describe_table` — Date là DateTime, số là Int64/Decimal |
| 3 | **Mô hình hoá** — star schema, date table phủ toàn bộ phạm vi, Many→One từ fact vào dim | MS [modeling-guidelines](references/microsoft/modeling-guidelines.md) · [naming-conventions](references/microsoft/naming-conventions.md) | `distill_model_schema` → ERD đúng hình sao, không quan hệ thừa/ngược |
| 4 | **Measure & cột tính** — thử bằng TOM, lưu bằng TMDL | [tom-tmdl-write](references/kpim/tom-tmdl-write.md) · [dax-best-practices](references/kpim/dax-best-practices.md) · MS [dax-guidelines](references/microsoft/dax-guidelines.md) · [tmdl-guidelines](references/microsoft/tmdl-guidelines.md) | Mỗi measure `EVALUATE ROW("kq", [M])` + đối chiếu 1 con số biết trước; mở lại file vẫn còn measure |
| 5 | **Hiệu năng** (khi chậm) | MS [dax-perf-decision-guide](references/microsoft/dax-perf-decision-guide.md) · [dax-perf-patterns](references/microsoft/dax-perf-patterns.md) | Thời gian truy vấn trước/sau có số đo |
| 6 | **Bàn giao sang truy vấn** — cập nhật `DATA_DICTIONARY` / `METRICS_CALCULATION` của dự án | — | Tài liệu dự án khớp model; chuyển [`pbi-analysis`](../pbi-analysis/SKILL.md) |

Ghi TMDL: tab-indent, CRLF, UTF-8 không BOM, `lineageTag` UUID mới, chèn trước `partition`.

## Tài liệu tham khảo

### KPIM — `references/kpim/`
| File | Đọc khi |
|---|---|
| [m-best-practices.md](references/kpim/m-best-practices.md) | Bước 1–2: query folding, `Value.NativeQuery`, connector, kiểu dữ liệu, incremental |
| [sql-best-practices.md](references/kpim/sql-best-practices.md) | Nguồn SQL/DW: SARGable, index, pre-aggregate, staging, SCD |
| [dax-best-practices.md](references/kpim/dax-best-practices.md) | Viết/tối ưu DAX: VAR, DIVIDE, date table (kể cả tạo bảng Date khi chưa có), calculation group, time-intel; mẫu xếp hạng `RANKX`, lũy kế, số dư cuối kỳ, parent-child, chọn measure bằng slicer; debug measure |
| [gotchas.md](references/kpim/gotchas.md) | Trước mỗi bước — bẫy đã trả giá (serial date, blank member, STOCK) |
| [tom-tmdl-write.md](references/kpim/tom-tmdl-write.md) | Bước 4 — ghi measure/cột tính/quan hệ; TOM vs TMDL |

### Microsoft (nguyên văn, v0.3.16) — `references/microsoft/`
| File | Đọc khi |
|---|---|
| [modeling-guidelines.md](references/microsoft/modeling-guidelines.md) | Thiết kế bảng, quan hệ, star schema |
| [naming-conventions.md](references/microsoft/naming-conventions.md) | Đặt tên bảng/cột/measure |
| [dax-guidelines.md](references/microsoft/dax-guidelines.md) | Quy ước viết DAX |
| [dax-perf-decision-guide.md](references/microsoft/dax-perf-decision-guide.md) · [dax-perf-patterns.md](references/microsoft/dax-perf-patterns.md) | Chẩn đoán và sửa DAX chậm |
| [tmdl-guidelines.md](references/microsoft/tmdl-guidelines.md) · [pbip.md](references/microsoft/pbip.md) | Sửa TMDL, cấu trúc thư mục PBIP |
| [metadata-discovery.md](references/microsoft/metadata-discovery.md) | Đọc metadata model (INFO.*, DMV) |
| [connection-binding.md](references/microsoft/connection-binding.md) | Nguồn/kết nối, binding khi deploy |
| [direct-lake-guidelines.md](references/microsoft/direct-lake-guidelines.md) | Model Direct Lake trên Fabric |
| [semantic-model-ai-readiness.md](references/microsoft/semantic-model-ai-readiness.md) | Chuẩn bị model cho Copilot/AI |
| [semantic-model-rest-api.md](references/microsoft/semantic-model-rest-api.md) | Thao tác model qua REST (xem thêm `pbi-publish`) |
| [SOURCE.lock.json](references/microsoft/SOURCE.lock.json) | Kiểm file nguyên văn chưa bị sửa (sha256) |

Reference Microsoft **không sửa byte nào**; muốn nói khác thì ghi vào `references/kpim/`.
Khi tài liệu xung đột: Microsoft quyết định cơ chế TMDL/PBIR; định nghĩa nghiệp vụ của dự án đã được người dùng duyệt quyết định cách tính.

## Đổi tên skill Microsoft → studio
Reference nguyên văn nhắc tên skill gốc; đọc theo bảng này.

| Tên trong reference Microsoft | Skill studio |
|---|---|
| `semantic-model-authoring` | `pbi-model` (skill này) |
| `powerbi-report-authoring` | [`pbi-build`](../pbi-build/SKILL.md) |
| `powerbi-report-design` | [`pbi-design`](../pbi-design/SKILL.md) |
| `powerbi-report-planning` | [`data-discovery`](../data-discovery/SKILL.md) (yêu cầu) · [`pbi-build`](../pbi-build/SKILL.md) (điều phối) |
| `powerbi-report-management` · `common/*` | [`pbi-publish`](../pbi-publish/SKILL.md) |
| `fabriciq` | không có trong studio |

Link tương đối bên trong file Microsoft (`../SKILL.md`, `../../../common/…`) trỏ theo cây upstream và có thể không mở được ở đây — tra bảng trên.

---
*Nguồn: KPIM practice + microsoft/skills-for-fabric v0.3.16 (MIT, tham chiếu nguyên văn; chưa distill vào SKILL.md).*

Files in this skill

  • SKILL.md9 KB
  • references/kpim/dax-best-practices.md12.7 KB
  • references/kpim/gotchas.md2.6 KB
  • references/kpim/m-best-practices.md3.3 KB
  • references/kpim/sql-best-practices.md3.4 KB
  • references/kpim/tom-tmdl-write.md4.4 KB
  • references/microsoft/SOURCE.lock.json3.4 KB
  • references/microsoft/connection-binding.md10.6 KB
  • references/microsoft/dax-guidelines.md11.1 KB
  • references/microsoft/dax-perf-decision-guide.md32.2 KB
  • references/microsoft/dax-perf-patterns.md30 KB
  • references/microsoft/direct-lake-guidelines.md3.2 KB
  • references/microsoft/metadata-discovery.md7.1 KB
  • references/microsoft/modeling-guidelines.md16.3 KB
  • references/microsoft/naming-conventions.md4.3 KB
  • references/microsoft/pbip.md3.9 KB
  • references/microsoft/semantic-model-ai-readiness.md13.5 KB
  • references/microsoft/semantic-model-rest-api.md19.8 KB
  • references/microsoft/tmdl-guidelines.md16 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.