powerbi-report-authoring
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCRITICAL NOTES
- To find the workspace details (including its ID) from workspace name: list all workspaces and, then, use JMESPath filtering
- To find the item details (including its ID) from workspace ID, item type, and item name: list all items of that type in that workspace and, then, use JMESPath filtering
重要注意事项
- 从工作区名称查找工作区详情(包括其ID):列出所有工作区,然后使用JMESPath筛选
- 从工作区ID、项类型和项名称查找项详情(包括其ID):列出该工作区中该类型的所有项,然后使用JMESPath筛选
Power BI Report Authoring Skill (PBIR/PBIP Format)
Power BI报表创作技能(PBIR/PBIP格式)
This skill enables reading, editing, and creation of Power BI report
definition files in the PBIR (Power BI Report) format used by PBIP
(Power BI Project) files.
本技能支持读取、编辑和创建PBIR(Power BI报表)格式的Power BI报表定义文件,该格式为PBIP(Power BI项目)文件所使用。
Must/Prefer/Avoid
必须/推荐/避免
MUST
必须
- Use this skill only for concrete PBIR/PBIP report-file mechanics such as pages, visuals, filters, slicers, navigation, bookmarks, themes, formatting, validation, Desktop reloads, and screenshots.
- Validate PBIR with after each logical batch.
powerbi-report-author validate - Use reload/screenshot workflows for rendered-output changes.
powerbi-desktop - Use CLI capability lookup before writing visual roles, formatting objects, enum values, selectors, or expression encodings.
- 仅将本技能用于具体的PBIR/PBIP报表文件操作,例如页面、可视化组件、筛选器、切片器、导航、书签、主题、格式设置、验证、Desktop重载和截图。
- 完成每一批次逻辑修改后,使用验证PBIR。
powerbi-report-author validate - 对于渲染输出的更改,使用重载/截图流程。
powerbi-desktop - 在编写可视化角色、格式对象、枚举值、选择器或表达式编码之前,先查询CLI功能。
PREFER
推荐
- Start from an approved or
Design Brief:for greenfield report builds._brief/report-spec.md - Route visual-design uncertainty to before writing files.
powerbi-report-design - For semantic model metadata or model-side changes, use a semantic-model authoring skill, Power BI Modeling MCP, or local TMDL files when available.
- 从零开始构建报表时,从已获批的或
Design Brief:入手。_brief/report-spec.md - 在编写文件之前,将可视化设计相关的不确定性问题转至处理。
powerbi-report-design - 对于语义模型元数据或模型端更改,若可用则使用语义模型创作技能、Power BI建模MCP或本地TMDL文件。
AVOID
避免
- Do not guess PBIR JSON from memory when CLI metadata or reference files are available.
- Do not use only this skill for open-ended design, report planning, or Fabric report item CRUD; pair it with ,
powerbi-report-design, orpowerbi-report-planning.powerbi-report-management
- 当CLI元数据或参考文件可用时,不要凭记忆猜测PBIR JSON结构。
- 不要仅使用本技能进行开放式设计、报表规划或Fabric报表项CRUD操作;需搭配、
powerbi-report-design或powerbi-report-planning使用。powerbi-report-management
Quick Start Workflow
快速开始流程
- Plan/design routing → for greenfield builds, read first; for theming, visual style, layout, redesigns, or critiques, read
powerbi-report-planning. Return here for PBIR mechanics. Before authoring, use thepowerbi-report-designyaml block fromDesign Brief:(or an approved inline_brief/report-spec.mdblock in the conversation) as implementation context.Design Brief: - Set up/update CLIs → before first use, confirm and the global
powerbi-report-authorcommand are available; see CLI Setup.powerbi-desktop - Understand the model → use the Semantic Model MCP Server/skill if available, or read TMDL files directly for table/column/measure names
- Desktop context → for live Desktop status, opening PBIP/PBIX files,
reloads, screenshots, or visual verification, use the
CLI from
powerbi-desktop; see Edit → Validate → Reload → Screenshot Loop.@microsoft/powerbi-desktop-bridge-cli - Route by intent → use Topic Files and Examples to pick the relevant guide.
- Use CLI metadata → use Authoring Metadata & Validation CLI for exact visual roles, formatting objects, property names, enum values, and selector requirements; do not infer these from memory.
- Check common pitfalls → read Anti-Patterns and Pitfalls before editing or validating when the change touches visuals, bindings, filters, formatting, layout, or Desktop rendering.
- Validate → run after every logical batch of PBIR changes; see Validation.
powerbi-report-author validate <path-to-.Report-dir> - Verify rendering → for any rendered-output change, use reload + screenshots; see Edit → Validate → Reload → Screenshot Loop and Screenshot Review. Do not proceed until both validation and visual review pass. For dashboard/report builds, page scaffolding is not completion — each requested page needs data-bound visuals.
powerbi-desktop - Report back → give the user a concise summary of what was done and any issues encountered (major and minor).
- 规划/设计路由 → 从零开始构建报表时,先阅读;涉及主题、可视化样式、布局、重新设计或评审时,阅读
powerbi-report-planning。返回此处进行PBIR具体操作。创作前,将powerbi-report-design中的_brief/report-spec.mdyaml块(或对话中已获批的内嵌Design Brief:块)作为实现上下文。Design Brief: - 设置/更新CLI → 首次使用前,确认和全局
powerbi-report-author命令可用;请查看CLI设置。powerbi-desktop - 理解模型 → 若可用则使用语义模型MCP服务器/技能,或直接读取TMDL文件获取表/列/度量值名称
- Desktop上下文 → 如需实时Desktop状态、打开PBIP/PBIX文件、重载、截图或可视化验证,请使用中的
@microsoft/powerbi-desktop-bridge-cliCLI;请查看编辑 → 验证 → 重载 → 截图循环。powerbi-desktop - 按意图路由 → 使用主题文件与示例选择相关指南。
- 使用CLI元数据 → 使用创作元数据与验证CLI获取准确的可视化角色、格式对象、属性名称、枚举值和选择器要求;不要凭记忆推断这些内容。
- 检查常见陷阱 → 当更改涉及可视化组件、绑定、筛选器、格式设置、布局或Desktop渲染时,在编辑或验证前阅读反模式与陷阱。
- 验证 → 完成每一批次PBIR逻辑修改后,运行;请查看验证。
powerbi-report-author validate <path-to-.Report-dir> - 确认渲染效果 → 对于任何渲染输出更改,使用重载+截图;请查看编辑 → 验证 → 重载 → 截图循环和截图评审。必须在验证和可视化评审均通过后才能继续。对于仪表板/报表构建,页面框架搭建完成并不代表结束——每个请求的页面都需要绑定数据的可视化组件。
powerbi-desktop - 反馈结果 → 向用户简要总结已完成的操作以及遇到的所有问题(包括主要和次要问题)。
Topic Files and Examples
主题文件与示例
Use the user's intent to choose the relevant topic file(s) before editing:
| File | When to read |
|---|---|
| Adding/modifying pages, visuals, drillthrough, interactions — includes complete JSON examples |
| Live Desktop verification — |
| Screenshot review checklist and rendered-output troubleshooting after Desktop screenshot capture |
| Read first for appearance changes — cascade model, encoding rules, selectors, routing to other formatting files |
| Editing |
| Chart data point colors — theme |
| Data-driven formatting — color gradients (FillRule), rules-based, icon sets, data bars, web URL, field value |
| Editing |
| Filter pane ( |
| Creating or editing |
| Switching themes on a report with existing visuals — re-theming workflow (color mapping + bulk sweep), dark mode checklist, dark↔light polarity changes. Pair with |
| Building field references (Column, Measure, Aggregation, Hierarchy) and sort definitions |
| Adding/modifying filters — includes complete JSON examples |
| Read first when adding/modifying slicers or slicer selections — agent workflow, JSON templates, selection config |
| Adding bar, column, line charts — families, roles, query patterns (multi-measure, drill hierarchy, date hierarchy), formatting |
| Adding map visuals — template, roles, geocoding workflow, handling render failures |
| Adding or formatting KPI/card visuals — |
| Adding or formatting tables/matrices — |
| Adding image visuals — local resources, URLs, data-bound images, ImageUrl validation/refusal workflow; also plot area background images for chart visuals |
| Adding shape visuals — containers, dividers, backgrounds, reference-image matching |
| Adding static or dynamic textbox visuals — paragraphs, text runs, and bound value expressions |
| Git branching, committing, reverting — read when the task involves version control or safe rollback planning |
在编辑前,根据用户意图选择相关主题文件:
| 文件 | 阅读场景 |
|---|---|
| 添加/修改页面、可视化组件、钻取、交互——包含完整JSON示例 |
| 实时Desktop验证—— |
| 截图评审清单和Desktop截图捕获后的渲染输出故障排查 |
| 外观更改请先阅读——级联模型、编码规则、选择器、转至其他格式文件的路由 |
| 编辑 |
| 图表数据点颜色——主题 |
| 数据驱动格式设置——颜色渐变(FillRule)、基于规则、图标集、数据条、Web URL、字段值 |
| 编辑 |
| 筛选窗格( |
| 创建或编辑 |
| 为已有可视化组件的报表切换主题——重新主题化流程(颜色映射+批量扫描)、深色模式清单、深色↔浅色极性更改。当更改带有每个可视化组件覆盖设置的报表颜色时,请搭配 |
| 构建字段引用(列、度量值、聚合、层次结构)和排序定义 |
| 添加/修改筛选器——包含完整JSON示例 |
| 添加/修改切片器或切片器选择时请先阅读——Agent流程、JSON模板、选择配置 |
| 添加条形图、柱形图、折线图——系列、角色、查询模式(多度量值、钻取层次结构、日期层次结构)、格式设置 |
| 添加地图可视化组件——模板、角色、地理编码流程、处理渲染失败 |
| 添加或格式化KPI/卡片可视化组件—— |
| 添加或格式化表格/矩阵—— |
| 添加图片可视化组件——本地资源、URL、数据绑定图片、ImageUrl验证/拒绝流程;还包括图表可视化组件的绘图区背景图片 |
| 添加形状可视化组件——容器、分隔线、背景、参考图片匹配 |
| 添加静态或动态文本框可视化组件——段落、文本运行和绑定值表达式 |
| Git分支、提交、回滚——当任务涉及版本控制或安全回滚规划时阅读 |
Greenfield / Design Handoff
从零开始构建 / 设计交接
This skill owns PBIR file mechanics once the work is concrete: page/visual JSON, bindings, filters, slicers, themes, formatting, navigation, bookmarks, validation, Desktop reloads, and screenshots.Usebefore authoring for new report/dashboard requests, requirements gathering, dependency checks, approval, or end-to-end build sequencing. Usepowerbi-report-planningfor open-ended visual design, redesign/restyle, brand/theme direction, chart selection, or layout critique. Return here once there is an approved spec/design brief or a concrete PBIR edit to implement — see Quick Start step 0 for how to consume the brief.powerbi-report-design
一旦工作内容明确,本技能负责PBIR文件的具体操作:页面/可视化组件JSON、绑定、筛选器、切片器、主题、格式设置、导航、书签、验证、Desktop重载和截图。对于新报表/仪表板请求、需求收集、依赖项检查、审批或端到端构建排序,请在创作前使用。对于开放式可视化设计、重新设计/重新样式、品牌/主题方向、图表选择或布局评审,请使用powerbi-report-planning。当有已获批的规范/设计brief或具体的PBIR编辑任务时,返回此处——请查看快速开始步骤0了解如何使用brief。powerbi-report-design
Large Build Execution
大型报表构建执行
For full report/PBIP builds, do not delegate complete PBIP generation to a
subagent — the owning agent must keep the design brief, model inventory,
cross-page consistency, validation loop, and Desktop verification coordinated.
When context or repetition is the constraint, prefer a deterministic Node.js
generator that reads the approved design brief and writes PBIR JSON. If
delegation is still useful, split it by page or visual family and give each
subagent the relevant brief excerpt, exact fields/measures, and layout/visual
contract; have it return scoped PBIR JSON or a patch for the owning agent to
integrate and validate.
对于完整报表/PBIP构建,不要将完整PBIP生成任务委托给子Agent——主Agent必须协调设计brief、模型清单、跨页面一致性、验证循环和Desktop验证。
当上下文或重复操作成为限制因素时,建议使用确定性Node.js生成器,读取已获批的设计brief并编写PBIR JSON。若仍需委托,请按页面或可视化组件系列拆分任务,为每个子Agent提供相关brief摘录、准确字段/度量值和布局/可视化组件约定;让子Agent返回限定范围的PBIR JSON或补丁,由主Agent整合并验证。
CLI Setup
CLI设置
Prerequisite: Node.js 20 or later. Check with . If missing
or older, install from nodejs.org or via your package
manager — Windows: ; macOS: ;
Linux: distro package or nodesource.
node --versionwinget install OpenJS.NodeJS.LTSbrew install nodeBefore using the CLIs in a session, ensure the latest global versions are
installed:
bash
npm install -g @microsoft/powerbi-report-authoring-cli@latest @microsoft/powerbi-desktop-bridge-cli@latestConfirm both are on :
PATHbash
powerbi-report-author --version
powerbi-desktop --version前提条件:Node.js 20或更高版本。 使用检查。若未安装或版本过低,请从nodejs.org或包管理器安装——Windows:;macOS:;Linux:发行版包或nodesource。
node --versionwinget install OpenJS.NodeJS.LTSbrew install node在会话中使用CLI前,确保安装了最新的全局版本:
bash
npm install -g @microsoft/powerbi-report-authoring-cli@latest @microsoft/powerbi-desktop-bridge-cli@latest确认两者均在中:
PATHbash
powerbi-report-author --version
powerbi-desktop --versionPBIR File Layout
PBIR文件布局
A PBIP project on disk looks like this:
text
<Report>.pbip # Project manifest
├── <Report>.Report/
│ ├── .platform # Fabric metadata (type, logicalId)
│ ├── definition.pbir # Report → SemanticModel binding
│ ├── definition/
│ │ ├── version.json # Format version (e.g. "2.0.0")
│ │ ├── report.json # Report-level: themes, settings, resources
│ │ └── pages/
│ │ ├── pages.json # Page order + active page name
│ │ └── <pageId>/
│ │ ├── page.json # Page: displayName, size, type, filters
│ │ └── visuals/
│ │ └── <visualId>/
│ │ └── visual.json # Visual: type, position, query, formatting
│ ├── CustomVisuals/ # Third-party .pbiviz packages
│ └── StaticResources/
│ ├── SharedResources/BaseThemes/ # Built-in base themes
│ └── RegisteredResources/ # User images, custom theme JSON
└── <Report>.SemanticModel/ # OUT OF SCOPE磁盘上的PBIP项目结构如下:
text
<Report>.pbip # 项目清单
├── <Report>.Report/
│ ├── .platform # Fabric元数据(类型、logicalId)
│ ├── definition.pbir # 报表 → 语义模型绑定
│ ├── definition/
│ │ ├── version.json # 格式版本(例如 "2.0.0")
│ │ ├── report.json # 报表级:主题、设置、资源
│ │ └── pages/
│ │ ├── pages.json # 页面顺序 + 活动页面名称
│ │ └── <pageId>/
│ │ ├── page.json # 页面:displayName、尺寸、类型、筛选器
│ │ └── visuals/
│ │ └── <visualId>/
│ │ └── visual.json # 可视化组件:类型、位置、查询、格式设置
│ ├── CustomVisuals/ # 第三方.pbiviz包
│ └── StaticResources/
│ ├── SharedResources/BaseThemes/ # 内置基础主题
│ └── RegisteredResources/ # 用户图片、自定义主题JSON
└── <Report>.SemanticModel/ # 超出范围Key Files
关键文件
| File | Purpose | Agent rule |
|---|---|---|
| Fabric/PBIP report item metadata | Keep it with the |
| Report → semantic model binding via | Preserve schema/version unless intentionally migrating |
| PBIR format metadata | Preserve the full scaffolded file, including |
| Report-level settings, themes, resources | Edit through references and validate after changes |
| Page order and active page | Add every new page to |
| Page metadata, size, filters | Preserve dimensions unless resizing is approved |
| Visual type, position, query, formatting | Validate roles and formatting with CLI metadata |
| User-local settings | Do not commit or rely on it |
Schema URLs use the prefix .
The suffixes are versioned PBIR contracts that Power BI Desktop bumps with most
releases (e.g. , , at the
time of writing — newer values may appear in any user's PBIP). When editing,
always preserve the existing value; when adding a new file, copy
the URL from an existing file of the same type in the same report.
Do not invent or bump versions on your own. Validate with .
developer.microsoft.com/json-schemas/fabric/item/report/definition/visualContainer/2.9.0page/2.1.0report/3.3.0$schema$schemapowerbi-report-author validate| 文件 | 用途 | Agent规则 |
|---|---|---|
| Fabric/PBIP报表项元数据 | 与 |
| 通过 | 除非有意迁移,否则保留架构/版本 |
| PBIR格式元数据 | 保留完整的脚手架文件,包括 |
| 报表级设置、主题、资源 | 通过参考文件编辑,更改后进行验证 |
| 页面顺序和活动页面 | 将每个新页面添加到 |
| 页面元数据、尺寸、筛选器 | 除非获批调整尺寸,否则保留原有尺寸 |
| 可视化组件类型、位置、查询、格式设置 | 使用CLI元数据验证角色和格式设置 |
| 用户本地设置 | 不要提交或依赖此文件 |
架构URL使用前缀。后缀是版本化的PBIR契约,Power BI Desktop在大多数版本更新中都会升级(例如撰写本文时为、、——用户的PBIP中可能出现更新的值)。编辑时,始终保留现有值;添加新文件时,从同一报表中相同类型的现有文件复制URL。不要自行创建或升级版本。使用进行验证。
developer.microsoft.com/json-schemas/fabric/item/report/definition/visualContainer/2.9.0page/2.1.0report/3.3.0$schema$schemapowerbi-report-author validateAuthoring Metadata & Validation CLI
创作元数据与验证CLI
Use whenever you need PBIR facts that should not be
guessed: visual types, data roles, formatting objects, property names, enum
values, selectors, expression/value encodings, and report validation. The CLI is
the source of truth for PBIR authoring details; examples and memory are not.
powerbi-report-author| Command | Purpose | When to use |
|---|---|---|
| List all built-in visual types (and any deprecated entries) | Choosing a visual type |
| Roles, formatting keys, cardinality | Before creating/editing a visual |
| Valid | Before applying formatting |
| Property names, types, enum values, descriptions; | Finding exact property names and allowed values |
| Focused single-property lookup | When you already know the object and want just one property |
| Regex search across all formatting objects + VCOs | When you don't know which object a property belongs to |
| Enumerate shared visualContainerObjects | Auditing chrome/container formatting surface |
| Full validation of a | After every batch of changes |
| Report inventory: | Auditing existing report content |
| Command syntax and available options | Before using an unfamiliar command or flag |
More commands: .
powerbi-report-author-cli.md当需要不应猜测的PBIR信息时,请使用:可视化类型、数据角色、格式对象、属性名称、枚举值、选择器、表达式/值编码和报表验证。CLI是PBIR创作细节的权威来源;示例和记忆不可靠。
powerbi-report-author| 命令 | 用途 | 使用场景 |
|---|---|---|
| 列出所有内置可视化类型(以及任何已弃用的条目) | 选择可视化类型时 |
| 角色、格式键、基数 | 创建/编辑可视化组件前 |
| 有效的 | 应用格式设置前 |
| 属性名称、类型、枚举值、描述;需要id选择器时的 | 查找准确的属性名称和允许值时 |
| 聚焦单个属性查询 | 已知对象,仅需查询单个属性时 |
| 在所有格式对象 + VCO中进行正则搜索 | 不知道属性属于哪个对象时 |
| 枚举共享的visualContainerObjects | 审核Chrome/容器格式设置范围时 |
| 对 | 每批次更改后 |
| 报表清单: | 审核现有报表内容时 |
| 命令语法和可用选项 | 使用不熟悉的命令或标志前 |
更多命令:。
powerbi-report-author-cli.mdValidation result handling
验证结果处理
Run after every logical
batch of PBIR edits.
powerbi-report-author validate <path-to-.Report-dir>- / non-zero exit: fix every error before Desktop reload. Desktop may reject or misrender invalid PBIR.
failed - : review warnings before proceeding. Unknown visual types or theme visual keys usually mean a typo unless the report intentionally uses a custom
succeededWithWarnings..pbiviz - Diagnostics include file paths and JSON paths. Use them to jump directly to the broken node.
- For large diagnostics, use for readable output or
--prettyto write the full result to a file.--out <file>
完成每一批次PBIR编辑后,运行。
powerbi-report-author validate <path-to-.Report-dir>- / 非零退出码:在Desktop重载前修复所有错误。Desktop可能会拒绝或错误渲染无效的PBIR。
failed - :继续前查看警告。未知可视化类型或主题可视化键通常表示输入错误,除非报表有意使用自定义
succeededWithWarnings。.pbiviz - 诊断信息包含文件路径和JSON路径。使用这些信息直接跳转到出错节点。
- 对于大量诊断信息,使用获取可读输出,或使用
--pretty将完整结果写入文件。--out <file>
Visual Capability Guardrails
可视化组件能力约束
Use these as pre-edit safety rails. Always confirm exact roles, formatting
objects, properties, enum values, and selectors with
before editing.
powerbi-report-author将这些作为编辑前的安全准则。编辑前始终使用确认准确的角色、格式对象、属性、枚举值和选择器。
powerbi-report-authorPrefer modern visual types
优先使用现代可视化类型
Never create legacy visual types. If repairing an existing legacy visual,
migrate to the modern type and rebuild roles/formatting from CLI metadata.
| Do not create | Use instead |
|---|---|
| |
| |
| |
| |
| |
永远不要创建旧版可视化类型。若修复现有旧版可视化组件,请迁移到现代类型并根据CLI元数据重新构建角色/格式设置。
| 不要创建 | 替代方案 |
|---|---|
| |
| |
| |
| |
| |
Instance Selectors
实例选择器
Some formatting objects need selectors. Run and ; follow and the
dual-entry pattern in .
{ id: ... }formatting list-objectsformatting describe-object_selectorHintreferences/formatting.md某些格式对象需要选择器。运行和;遵循和中的双条目模式。
{ id: ... }formatting list-objectsformatting describe-object_selectorHintreferences/formatting.mdEdit → Validate → Reload → Screenshot Loop
编辑 → 验证 → 重载 → 截图循环
For rendered-output changes, follow this loop. Do not report completion until
validation, reload, and screenshot review are clean.
text
┌──────────────────────────────────────────────────────────┐
│ 1. Edit PBIR files │
│ 2. Validate → errors? fix and go to 1 │
│ 3. Desktop status → choose the correct bridge PID │
│ 4. Desktop reload → error? fix PBIR and go to 1 │
│ 5. Screenshot/review → issues? fix and go to 1 │
│ 6. Clean → report completion │
└──────────────────────────────────────────────────────────┘Rules:
- Step 2 — . Pass the report definition directory (e.g.,
powerbi-report-author validate <path-to-.Report-dir>), not theSales.Reportfile or project root. Fix all errors before reload — invalid PBIR errors will surface in Desktop..pbip - Steps 3–5 — use CLI:
powerbi-desktopto choose the PID, thenstatusfor PBIP/PBIR current files and screenshots from the same PID. Then perform the screenshot review below. Afterreload --pid <pid>, if the selected instance hasstatus, do not reload yet; ask the user to save or discard their Desktop UI changes, rerunhasUnsavedChanges: true, and continue only once it is false.statuscovers report/PBIR changes only. For semantic-model/TMDL changes, use a semantic-model skill or Modeling MCP and reopen the PBIP if changes are not reflected. Exception: Theme JSON files are cache-keyed by name — Desktop may not pick up edits on reload. Either rename the theme file with a random suffix (and updatereload), or close and reopen Desktop.report.json
Desktop CLI commands:
| Command | Purpose | When to use |
|---|---|---|
| Launch Power BI Desktop for a PBIP/PBIX | Starting Desktop or opening the target report |
| List Desktop Bridge instances, current files, report dirs, and bridge state | Before reload/screenshot; choose the correct PID |
| Reload the selected Desktop instance's current PBIP report files | After validated PBIR edits in an open PBIP |
| Capture one page by PBIR page ID | Isolated page changes |
| Capture every report page | Theme, navigation, page-order, or report-wide changes |
Use when only one PBIR
page needs review. is supported only for PBIP-backed reports. No command accepts ; use
to select the Desktop instance by PID because the same PBIP can be open in more
than one process. Screenshots default to scale . Run reload and screenshot
operations serially per PID — never in parallel against the same PID, even as a
workaround for a slow or retryable error. Read for the
complete command reference and troubleshooting workflow.
powerbi-desktop screenshot <page-id> --pid <pid>reloadpowerbi-desktop--reportstatus2references/powerbi-desktop.mdCommon Desktop CLI outcomes:
| Output/error | Meaning | Action |
|---|---|---|
| No Desktop Bridge discoverable | Run |
| More than one Desktop Bridge instance is available | Run |
| Desktop build lacks a required production bridge method | Tell the user Desktop is stale/unsupported — see docs |
| Desktop is up but the report host isn't ready (often briefly after a reload) | CLI auto-retries; rerun once if it surfaces. Do not add custom sleeps — rely on the CLI's retry path. |
| A reload or screenshot exceeded the CLI's retry budget | Confirm |
| A reload/screenshot was cancelled — usually a concurrent reload/screenshot on the same PID. Distinct from | Run reload and screenshot serially per PID. Wait for |
| Desktop rejected the PBIR definition | Fix PBIR, run |
| Selected PID has no PBIP/PBIR current file; reload/screenshot-all need PBIP/PBIR state | Select the correct PID from |
对于渲染输出更改,请遵循此循环。必须在验证、重载和截图评审均通过后才能报告完成。
text
┌──────────────────────────────────────────────────────────┐
│ 1. 编辑PBIR文件 │
│ 2. 验证 → 有错误?修复后回到步骤1 │
│ 3. Desktop状态 → 选择正确的桥接PID │
│ 4. Desktop重载 → 有错误?修复PBIR后回到步骤1 │
│ 5. 截图/评审 → 有问题?修复后回到步骤1 │
│ 6. 完成 → 报告完成 │
└──────────────────────────────────────────────────────────┘规则:
- 步骤2 —— 。传入报表定义目录(例如
powerbi-report-author validate <path-to-.Report-dir>),而非Sales.Report文件或项目根目录。重载前修复所有错误——无效PBIR错误会在Desktop中显现。.pbip - 步骤3–5 —— 使用CLI:
powerbi-desktop选择PID,然后使用status重载PBIP/PBIR当前文件,并从同一PID获取截图。然后执行以下截图评审。 执行reload --pid <pid>后,如果所选实例显示status,请不要立即重载;请用户保存或丢弃其Desktop UI更改,重新运行hasUnsavedChanges: true,仅当值为false时继续。status仅覆盖报表/PBIR更改。对于语义模型/TMDL更改,请使用语义模型技能或建模MCP,若更改未反映则重新打开PBIP。 例外: 主题JSON文件按名称缓存——Desktop可能不会在重载时拾取编辑内容。可以为主题文件添加随机后缀重命名(并更新reload),或关闭并重新打开Desktop。report.json
Desktop CLI命令:
| 命令 | 用途 | 使用场景 |
|---|---|---|
| 为PBIP/PBIX启动Power BI Desktop | 启动Desktop或打开目标报表时 |
| 列出Desktop桥接实例、当前文件、报表目录和桥接状态 | 重载/截图前;选择正确的PID |
| 重载所选Desktop实例的当前PBIP报表文件 | 在已打开的PBIP中完成验证后的PBIR编辑后 |
| 通过PBIR页面ID捕获单个页面 | 孤立页面更改时 |
| 捕获所有报表页面 | 主题、导航、页面顺序或报表范围更改时 |
当仅需评审一个PBIR页面时,使用。仅支持对PBIP支持的报表进行。没有命令接受;使用按PID选择Desktop实例,因为同一PBIP可能在多个进程中打开。截图默认缩放比例为2。每个PID的重载和截图操作需串行执行——即使是为解决缓慢或可重试错误的变通方案,也不要对同一PID并行执行。请阅读获取完整命令参考和故障排除流程。
powerbi-desktop screenshot <page-id> --pid <pid>reloadpowerbi-desktop--reportstatusreferences/powerbi-desktop.md常见Desktop CLI结果:
| 输出/错误 | 含义 | 操作 |
|---|---|---|
| 未发现Desktop桥接 | 运行 |
| 存在多个Desktop桥接实例 | 运行 |
| Desktop版本缺少所需的生产桥接方法 | 告知用户Desktop版本过旧/不支持——查看文档 |
| Desktop已启动但报表主机未就绪(通常在重载后短暂出现) | CLI会自动重试;若出现则重新运行一次。不要添加自定义休眠——依赖CLI的重试路径。 |
| 重载或截图超出CLI的重试预算 | 确认 |
| 重载/截图被取消——通常是同一PID上存在并发重载/截图。与 | 每个PID的重载和截图操作串行执行。通过 |
| Desktop拒绝PBIR定义 | 修复PBIR,运行 |
| 所选PID没有PBIP/PBIR当前文件;重载/screenshot-all需要PBIP/PBIR状态 | 从 |
Screenshot Review
截图评审
After taking screenshots, perform an independent rendered-output review before reporting completion. Read , check layout, data rendering, formatting/theme, slicers, and common screenshot failure modes, then fix PBIR and repeat the loop until clean.
screenshot-review.md截取截图后,在报告完成前独立评审渲染输出。阅读,检查布局、数据渲染、格式设置/主题、切片器和常见截图失败模式,然后修复PBIR并重复循环直到无问题。
screenshot-review.mdValidation
验证
Run after every logical batch of PBIR
changes. Prefer the directory; the CLI also accepts a file or
a project root containing a single directory. Errors block Desktop
reload — fix them first. Review warnings and fix unless there's a clear reason
not to.
powerbi-report-author validate <path>.Report.pbip.ReportThe validator is an offline preflight covering PBIR structure, JSON/schema
validity, cross-file references, IDs/names, visual types, role bindings,
filters, formatting objects/properties/enums/selectors, visualContainerObjects,
theme registration, layout bounds, and selected Desktop/rendering failure
patterns. It does not replace Desktop reload and screenshot review.
完成每一批次PBIR更改后,运行。优先传入目录;CLI也接受文件或包含单个目录的项目根目录。错误会阻止Desktop重载——先修复错误。查看警告并修复,除非有明确的理由不修复。
powerbi-report-author validate <path>.Report.pbip.Report验证器是离线预检工具,覆盖PBIR结构、JSON/架构有效性、跨文件引用、ID/名称、可视化类型、角色绑定、筛选器、格式对象/属性/枚举/选择器、visualContainerObjects、主题注册、布局边界和选定的Desktop/渲染失败模式。它不能替代Desktop重载和截图评审。
Anti-Patterns and Pitfalls
反模式与陷阱
| Pitfall | Consequence | Fix |
|---|---|---|
Using | Filter silently fails | Use |
Omitting | Visual calculations may break | Always include |
| Reusing visual/filter names | Unpredictable behavior | Generate unique IDs |
Setting | Visual renders as error box | Run |
| Wrong role name for visual type | Field is ignored; visual blank | Match role names from |
Mixing | Query fails; visual error | Columns use |
Forgetting to add page to | Page invisible | Add to |
| Booleans without correct format | Wrong type | |
| Numbers without type suffix | Type mismatch | |
Editing | PBI Desktop may reject | Preserve existing version |
Stringified JSON in | Textbox shows nothing | |
| Using textbox as a thin line/divider | Renders ~24px tall regardless of | Use a |
| Schema validation error in PBI Desktop | Must be inside |
Using | Headers render but no data rows even when DAX confirms data exists | Use |
Using PowerShell | Property reordering, nesting depth truncation ( | Use Node.js for JSON manipulation, or always pass |
| Using regex or string replacement to modify JSON files | Corrupts nesting structure — properties end up inside sibling values, braces misalign | Read file → |
| Bars/columns invisible despite data in tooltips | Use |
Using | All series/categories get the same color — no visual differentiation | Use theme |
| Clustered bar/column chart colors collapse into one legend color | The visual has a Series role but all bars and legend markers share the same hue | Use per-series |
Relying on theme | Same measure gets different colors on different visuals (index-based assignment varies with projection order) | Maintain a measure→color mapping and apply explicit |
Using | Colors silently resolve to white or black instead of expected palette color | Use |
| Choosing bar/series colors without checking background contrast | Bars or lines invisible against page/card background (e.g., white bars on white canvas) | Always pick saturated, mid-to-dark hues that contrast with the page and VCO background colors |
| Schema error — page | Only VCO |
| Copying property names from doc examples without verifying | Warnings or silent failures — property names vary by visual type | Always run |
| Guessing which object a property belongs to | Wasted calls checking wrong objects one by one | Run |
| Formatting property has no effect (no error) | Setting | Check |
Using | Properties validate but have no visible effect — | Use |
Using | Cards render empty — PBI Desktop cannot resolve the binding. Validator reports | |
Creating separate single-value | Wastes canvas space and misuses the visual type — | Default to one multi-value |
| Adding multiple fields to button slicer Values or Label roles | Slicer breaks or shows unexpected results — each role accepts only 1 field | Put one field in Values, one in Label; additional fields go to Tooltips |
Looking at | Slicer selections live only inside the slicer's own | |
| Creating an image visual without prompting for the source type | Wrong visual structure — URL vs local file vs data field each have different schemas and expression types | Always ask the user for the image source (local file / URL / data field) before creating the visual — see image.md § Source Types Overview |
Creating a data-bound image visual with a field that lacks | Visual renders blank or error | Warn the user first — the visual will render blank without |
| Placing background image on page canvas instead of visual plot area | User asks for "background image" alongside a visual (e.g., "column chart with background image") but image is placed on | When a background image is requested in the context of a specific visual, default to |
Creating a | Legacy multi-row card — deprecated; | Always use |
Using | Legacy Bing Maps visuals — deprecated and must not be created; | Always use |
Creating | Columns shrink-wrap to content, leaving unused whitespace | Always set |
| Custom table/matrix row colors with no effect (white background) | Default style preset overrides | Set |
| Table cells white despite dark VCO background | | Set dark colors in |
| Dark theme applied but cards/tables/slicers still white | Dark mode triggers every formatting trap simultaneously | Follow the full re-theming.md § Dark Mode Authoring Checklist — covers stylePreset, fillCustom+id selector, objects vs VCO, and contrast audit |
| Theme JSON changes do not appear after Desktop reload | Desktop caches theme files by file name | Rename the theme JSON with a small random suffix, update the theme registration in |
Placing | Schema validation error; sort silently ignored — chart falls back to alphabetical | |
| Container shape fill doesn't match reference | Text invisible or wrong background color | Match the fill color and transparency to the reference image. If the page background already provides the color, skip the shape entirely. If the shape must be invisible, verify text color still contrasts with the page canvas — see shape.md § Container Shapes |
| Shape text invisible after re-theme | Shape | Always set explicit |
Enabling | PBI Desktop silently falls back to linear scale with a warning — log of zero/negative is undefined | Warn the user before applying. Use |
| Changing theme without sweeping inline overrides | Old colors remain on shapes, page backgrounds, nav buttons, textboxes — theme-only change has no effect on hardcoded | When the report has per-visual color overrides, follow re-theming.md § Re-theming Workflow Steps 0–3: build a color mapping, update theme JSON, then bulk-sweep |
Changing only | Shapes, accent bars, nav button borders retain old accent colors — they use hardcoded Literal hex from the old | Sweep ALL old |
| 陷阱 | 后果 | 修复方案 |
|---|---|---|
在筛选器 | 筛选器静默失败 | 使用 |
省略 | 可视化计算可能中断 | 始终包含 |
| 重复使用可视化组件/筛选器名称 | 行为不可预测 | 生成唯一ID |
将 | 可视化组件渲染为错误框 | 运行 |
| 可视化类型使用错误的角色名称 | 字段被忽略;可视化组件空白 | 匹配 |
混合 | 查询失败;可视化组件报错 | 列使用 |
忘记将页面添加到 | 页面不可见 | 添加到 |
| 布尔值格式不正确 | 类型错误 | 使用 |
| 数字没有类型后缀 | 类型不匹配 | 小数使用 |
编辑 | PBI Desktop可能拒绝 | 保留现有版本 |
| 文本框无显示 | |
| 使用文本框作为细线/分隔线 | 无论 | 使用 |
| PBI Desktop中架构验证错误 | 必须位于 |
| 表头渲染但无数据行,即使DAX确认存在数据 | 使用 |
使用PowerShell | 属性重排序、嵌套深度截断( | 使用Node.js处理JSON,或始终传入 |
| 使用正则表达式或字符串替换修改JSON文件 | 破坏嵌套结构——属性可能出现在同级值内部,大括号错位 | 读取文件 → |
单系列图表中 | 柱状/条形不可见,但工具提示中有数据 | 使用 |
多系列图表中使用 | 所有系列/类别颜色相同——无视觉区分 | 使用主题 |
| 簇状条形/柱形图颜色合并为一个图例颜色 | 可视化组件有Series角色,但所有条形和图例标记共享同一色调 | 使用按系列的 |
仅依赖主题 | 同一度量值在不同可视化组件上显示不同颜色(基于投影顺序的索引分配不同) | 维护度量值→颜色映射,并在每个可视化组件上显式应用 |
对带元数据选择器的显式按度量值 | 颜色静默解析为白色或黑色,而非预期的调色板颜色 | 对带元数据选择器的显式颜色分配使用 |
| 选择条形/系列颜色时未检查背景对比度 | 条形或线条在页面/卡片背景下不可见(例如白色条形在白色画布上) | 始终选择饱和度高、中深色的色调,与页面和VCO背景颜色形成对比 |
页面级 | 架构错误——页面 | 只有可视化组件上的VCO |
| 未验证就从文档示例复制属性名称 | 警告或静默失败——属性名称因可视化类型而异 | 始终运行 |
| 猜测属性所属的对象 | 浪费时间逐个检查错误对象 | 运行 |
| 格式设置属性无效果(无错误) | 在cardVisual轮廓上设置 | 检查 |
在单值卡片上使用 | 属性验证通过但无可见效果—— | 对单值卡片使用带 |
对 | 卡片渲染空白——PBI Desktop无法解析绑定。验证器报告 | |
为多个相关KPI创建单独的单值 | 浪费画布空间并错误使用可视化类型—— | 当需要≥2个相关KPI时,默认使用一个多值 |
| 按钮切片器的Values或Label角色添加多个字段 | 切片器损坏或显示意外结果——每个角色仅接受1个字段 | 在Values中放一个字段,Label中放一个字段;额外字段放在Tooltips中 |
通过查看其他可视化组件的 | 切片器选择仅存储在切片器自身的 | |
| 创建图片可视化组件时未提示源类型 | 可视化组件结构错误——URL、本地文件和数据字段各自有不同的架构和表达式类型 | 创建可视化组件前始终询问用户图片来源(本地文件/URL/数据字段)——查看image.md § 源类型概述 |
使用缺少 | 可视化组件渲染空白或报错 | 先警告用户——没有 |
| 将背景图片放在页面画布而非可视化组件绘图区 | 用户要求“背景图片+可视化组件”(例如“带背景图片的柱形图”),但图片放在 | 当在特定可视化组件的上下文中请求背景图片时,默认放在 |
创建 | 旧版多行卡片——已弃用; | 始终使用 |
使用 | 旧版必应地图可视化组件——已弃用,禁止创建; | 始终使用 |
创建 | 列自动收缩以适应内容,留下未使用的空白 | 始终将 |
| 自定义表格/矩阵行颜色无效果(白色背景) | 默认样式预设覆盖 | 对每个带自定义颜色的 |
| 深色VCO背景下表格单元格仍为白色 | | 在 |
| 应用深色主题但卡片/表格/切片器仍为白色 | 深色模式会触发所有格式设置陷阱 | 遵循完整的re-theming.md § 深色模式创作清单——涵盖stylePreset、fillCustom+id选择器、objects vs VCO和对比度审核 |
| Desktop重载后主题JSON更改未生效 | Desktop按文件名缓存主题文件 | 为主题JSON添加随机小后缀重命名,更新 |
将 | 架构验证错误;排序被静默忽略——图表默认按字母顺序排序 | |
| 容器形状填充与参考图片不匹配 | 文本不可见或背景颜色错误 | 将填充颜色和透明度与参考图片匹配。若页面背景已提供该颜色,则完全省略形状。若形状必须不可见,请验证文本颜色仍与页面画布形成对比——查看shape.md § 容器形状 |
| 重新主题化后形状文本不可见 | 形状 | 始终在形状 |
对包含零或负值的数据启用 | PBI Desktop静默回退到线性比例并发出警告——零/负值的对数无定义 | 应用前警告用户。使用 |
| 更改主题但未扫描内联覆盖设置 | 形状、页面背景、导航按钮、文本框仍保留旧颜色——仅更改主题对级联中优先级2的硬编码 | 当报表有每个可视化组件的颜色覆盖设置时,遵循re-theming.md § 重新主题化流程步骤0–3:构建颜色映射,更新主题JSON,然后批量扫描 |
仅更改主题中的 | 形状、强调栏、导航按钮边框仍保留旧强调色——它们使用旧 | 扫描 |
Official Documentation
官方文档
For Microsoft Learn setup guidance, support constraints, and feature
availability, use Power BI report authoring docs.
有关Microsoft Learn设置指南、支持约束和功能可用性,请查看Power BI报表创作文档。