bi-dax-knowledge
DAX knowledge base for teaching a BI agent to reason about, generate, review, and performance-tune DAX for Power BI / tabular models. Use when the task involves writing or auditing DAX measures, building time-intelligence / segmentation / ranking / customer / currency calculations, reviewing a semantic model, diagnosing physical or virtual filter propagation, calculation-group precedence, semi-additive totals, blank/zero semantics, or explaining DAX concepts and pitfalls. Covers core concepts, best practices, anti-patterns, performance notes, a curated pattern library, reusable metric contracts, and analyzer rules.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-11
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- bi-dax-knowledge
- description
- DAX knowledge base for teaching a BI agent to reason about, generate, review, and performance-tune DAX for Power BI / tabular models. Use when the task involves writing or auditing DAX measures, building time-intelligence / segmentation / ranking / customer / currency calculations, reviewing a semantic model, diagnosing physical or virtual filter propagation, calculation-group precedence, semi-additive totals, blank/zero semantics, or explaining DAX concepts and pitfalls. Covers core concepts, best practices, anti-patterns, performance notes, a curated pattern library, reusable metric contracts, and analyzer rules.
02 资源文件 27
- 参考文档checklists/dax-diagnostic-checklist.md1.5 KB
- 参考文档checklists/dax-measure-review-checklist.md2.7 KB
- 参考文档checklists/dax-model-review-checklist.md2.3 KB
- 参考文档checklists/metric-contract-checklist.md2.3 KB
- 参考文档INDEX.md8.5 KB
- 参考文档knowledge/dax-anti-patterns.md5.4 KB
- 参考文档knowledge/dax-best-practices.md5.6 KB
- 参考文档knowledge/dax-calculate-deep-dive.md18.0 KB
- 参考文档knowledge/dax-calculation-groups-and-precedence.md2.8 KB
- 参考文档knowledge/dax-core-concepts.md9.3 KB
- 参考文档knowledge/dax-engine-internals.md8.4 KB
- 参考文档knowledge/dax-evaluation-context-deep-dive.md14.0 KB
- 参考文档knowledge/dax-function-semantics.md15.3 KB
- 参考文档knowledge/dax-performance-diagnostics.md9.8 KB
- 参考文档knowledge/dax-performance-notes.md4.3 KB
- 参考文档knowledge/dax-relationships-and-virtual-filters.md3.4 KB
- 参考文档knowledge/dax-retail-examples.md13.5 KB
- 参考文档knowledge/dax-semi-additive-and-blank-semantics.md3.2 KB
- 参考文档patterns/analyzer-rule-candidates.json15.9 KB
- 参考文档patterns/analyzer-rules.json15.8 KB
- 参考文档patterns/dax-patterns.json28.5 KB
- 参考文档patterns/metric-contract-patterns.json20.4 KB
- 参考文档README.md4.5 KB
- 参考文档references/agent-training-set.json18.6 KB
- 参考文档references/agent-training-set.md14.3 KB
- 参考文档references/retail-schema.md6.3 KB
- 参考文档references/source-map.md7.4 KB
03 SKILL.md 正文
BI DAX Knowledge
A teaching + reference layer for a Business Intelligence agent working with DAX. It separates explanation (Markdown, for reasoning and teaching) from structured rules (JSON, for precise generation and automated review).
When to use this skill
Trigger for any of: writing a DAX measure or calculated column; reviewing/auditing existing
DAX; building time intelligence (YTD, YOY, rolling, running totals), segmentation, ABC, ranking,
new/returning customers, events-in-progress, what-if parameters, or currency conversion;
reviewing a semantic model for DAX prerequisites; or explaining a DAX concept/pitfall.
Also trigger for ambiguous relationship paths, TREATAS/virtual-filter defects, interacting
calculation groups, semi-additive snapshot totals, and blank-versus-zero behavior.
How to use it (recommended workflow)
- Ground the model. Read
references/retail-schema.md. Map the user's real tables/columns onto these roles, or substitute their model. Never assume column names. - Reason from concepts first.
knowledge/dax-core-concepts.mdis the mental model (filter vs row context, context transition, CALCULATE, VAR, ALLSELECTED, lineage). Most bugs are concept errors, not syntax errors. - Pick the pattern. Find the matching entry in
patterns/dax-patterns.json(or read a worked version inknowledge/dax-retail-examples.md). Use itsdax_shape,key_rule,when_to_use,avoid_when, andcommon_mistakes. - Instantiate via a metric contract.
patterns/metric-contract-patterns.jsongives the structured spec (grain, additivity, required model features, validation, phase support). Define the contract before writing code. - Generate or review against the rules. Apply
patterns/analyzer-rules.jsonwhile generating, and as a checklist when auditing. Respectknowledge/dax-best-practices.mdand avoid everything inknowledge/dax-anti-patterns.md. - Tune. Use
knowledge/dax-performance-notes.mdto choose between equivalent formulations and to explain why a rewrite is faster. - Diagnose semantic behavior. For relationship, calculation-group, semi-additive, or blank
symptoms, use the focused
DX-*route inINDEX.mdand end onchecklists/dax-diagnostic-checklist.md.
Phases the agent supports
- generate — scaffold correct DAX from a metric contract + pattern.
- analyze — audit existing DAX/measures against
analyzer-rules.json. - model_review — check the semantic model for a contract's prerequisites (marked Date table, snapshot facts, disconnected param tables, config-table integrity, etc.).
Each pattern (future_agent_use) and contract (phase_support) declares which phases it serves.
File map
bi-dax-knowledge/
├─ SKILL.md ← this file (interface)
├─ INDEX.md ← the router (open after this file)
├─ README.md ← overview, scope, boundaries
├─ references/
│ ├─ retail-schema.md ← the fictional model all examples use
│ └─ source-map.md ← attribution + how content was derived
├─ knowledge/ ← Markdown: teaches the agent (read for reasoning)
│ ├─ dax-core-concepts.md ← concise on-ramp + index to the deep dives
│ ├─ dax-evaluation-context-deep-dive.md ← CC-001..003,008,009,018 (Definitive Guide, Slice 1)
│ ├─ dax-calculate-deep-dive.md ← CC-004..006,010,011,016,019 (Definitive Guide, Slice 1)
│ ├─ dax-function-semantics.md ← per-function return type/blank/gotchas (Definitive Guide, Slice 2)
│ ├─ dax-engine-internals.md ← SE vs FE, callbacks, VertiPaq/cardinality (Definitive Guide, Slice 3)
│ ├─ dax-performance-diagnostics.md ← triage workflow + 8 diagnostic playbooks (Slice 3)
│ ├─ dax-best-practices.md ← BP-xxx rules
│ ├─ dax-anti-patterns.md ← AP-xxx mistakes
│ ├─ dax-performance-notes.md ← intro perf primer (the "why" lives in engine-internals)
│ ├─ dax-retail-examples.md ← worked original examples
│ ├─ dax-relationships-and-virtual-filters.md ← DX-REL-* propagation diagnostics
│ ├─ dax-calculation-groups-and-precedence.md ← DX-CG-* composition diagnostics
│ └─ dax-semi-additive-and-blank-semantics.md ← DX-SA-* total/display diagnostics
├─ patterns/ ← JSON: precise reusable rules (read for generation/review)
│ ├─ dax-patterns.json ← 20-pattern library (per-pattern schema)
│ ├─ metric-contract-patterns.json ← 21 reusable metric specs (+ concept links, phase support)
│ ├─ analyzer-rules.json ← 20 enforceable AR-xxx rules (+ detectability/required_inputs/promoted_from)
│ └─ analyzer-rule-candidates.json ← ARC-xxx candidates; 10 promoted, 6 still staged (analyzer_v2/human)
└─ checklists/ ← short copy-me checklists (the artifact a route ends on)
├─ metric-contract-checklist.md ← fill a metric contract before writing DAX
├─ dax-measure-review-checklist.md ← pre-merge review of a measure
├─ dax-model-review-checklist.md ← semantic-model DAX prerequisites
└─ dax-diagnostic-checklist.md ← focused semantic diagnostic verdict
references/agent-training-set.md ← graded Q&A bank (36 items, 7 categories) for teaching/eval
references/agent-training-set.json ← machine-gradeable twin (same items)
Cross-reference scheme
- Best practices:
BP-xxx· Anti-patterns:AP-xxx· Analyzer rules:AR-xxx· semantic diagnostics:DX-REL-xxx,DX-CG-xxx,DX-SA-xxx. - Patterns link to contracts via
related_metric_contract; contracts link back viamaps_to_patterns; analyzer rules link to BP/AP docs viarefs.
Scope and boundaries
- Depth is code + key rules: the highest-value patterns with templates, rules, and original examples — not an exhaustive reproduction of any book.
- All DAX is original teaching code on the fictional retail schema. No verbatim
copyrighted code or sample model is reproduced. See
references/source-map.md. - This is a knowledge layer, not an execution engine: it does not run queries against a live model. Pair it with the user's model metadata for concrete generation/review.
04 同仓库更多 Skills
fake-skill
A fixture skill with declaring frontmatter, used as positive shipped evidence.
fake-skill
A fixture skill with declaring frontmatter, used as positive shipped evidence.
bare-skill-no-frontmatter
暂无简介
fake-skill
A fixture skill with declaring frontmatter, used as positive shipped evidence.
retail-kpi-knowledge
Retail KPI / metric-contract reasoning layer for BI agents in the Seshat BI project. Use when an agent must reason about the BUSINESS MEANING of a retail KPI before any implementation — defining a KPI in business terms, classifying additivity (fully/semi/non-additive), identifying grain, listing required source fields, resolving ambiguity (gross vs net, VAT, returns, cost method, same-store), choosing an MVP KPI pack, reviewing a metric contract for completeness, or preparing a clean handoff to an implementation layer. Also use it to classify KPI sufficiency or prepare an owner policy decision packet. This is a meaning/definition + review layer, not an executor: it does not write DAX/SQL/Python, grant readiness, approve policy, or design dashboards. See INDEX.md for live/planned routes; registry.yaml is the authoritative machine-readable inventory.
bi-sql-knowledge
SQL reasoning, validation, reconciliation, transformation, diagnostics, and anti-pattern knowledge layer for Seshat BI agents. Use when a task involves reasoning about source SQL: source profiling, table grain, keys & uniqueness, joins & fan-out amplification, aggregation correctness, COUNT/NULL semantics, deduplication, validation queries, reconciliation queries, silver/gold transformation logic, window/date-time analytics, SQL anti-patterns, or basic SQL performance reasoning, or interpretation of a supplied sanitized PostgreSQL JSON execution plan. The SQL counterpart to bi-dax-knowledge. It is a thinking & validation layer, not a database executor, runtime validator, dbt/Dagster project, or automatic tuning service.