VS Code extension for Power BI Projects (PBIP) in the PBIR format:
- Status bar: shows the page name and visual name whenever a
visual.json is open
- Explorer view (own icon in the Activity Bar) with three tabs:
- Pages: pages, visuals and the tables/columns each visual uses
- Fields: all columns/measures and where they are used (visuals, filters, measures, relationships, roles, …) — or that they are not used
- Roles: security roles (RLS/OLS) of the semantic model
- Model diagram in an editor tab: tables and relationships of the semantic model (UML-like)
- CSV export of the field usage and of the roles
Status bar
$(eye) Overview $(graph) Revenue by Region (visible page)
$(eye-closed) Overview $(graph) Revenue by Region (hidden page)
The tooltip also shows the visual type, page visibility and IDs. Clicking the entry opens the
related page.json. Changes are picked up live, including unsaved edits.
Where the names come from
| Item |
Source |
| Visual |
Title (visual.visualContainerObjects.title); for groups visualGroup.displayName; for text boxes the text; otherwise the slicer header or the names of the bound fields; otherwise visualType; finally the folder ID |
| Page |
displayName from ../../page.json |
| Visibility |
visibility from page.json (HiddenInViewMode = hidden) |
Explorer view
Click the extension's icon in the Activity Bar (left). The view has three tabs, each with its own
search box:
PAGES FIELDS ROLES
[ Search pages, visuals, visual types, fields ]
Pages tab
All reports in the workspace with their pages, visuals and the fields each visual uses:
▾ Sales 2 pages
▾ $(eye) Start 2 visuals
▸ Page filters 1 field
▾ Revenue by Region clusteredColumnChart
▾ Customer 2 fields
Region Category
Segment Filter
▾ Sales 2 fields
Amount Y, Sort
▸ Header group
▸ $(eye-closed) Details hidden · 5 visuals
- Pages are listed in the order defined in
pages.json; hidden pages show a crossed-out eye
- Groups are expandable nodes (via
parentGroupName)
- Visuals are sorted by their position on the page (top → bottom, left → right)
- Under each visual: the tables and columns/measures it uses, with their role (e.g.
Category,
Y, Values, Filter, Sort, Formatting). Columns of the automatic date hierarchy are shown
as the underlying date column
- Page-level filters are listed under "Page filters"
- Click opens
page.json / visual.json as a preview and keeps focus in the tree; double-click or
Enter moves focus to the editor
- Click on a table or field below a visual jumps to its definition in the semantic model
- The visual of the currently open file is selected in the tree automatically
Fields tab
All tables, columns and measures of the semantic model, and where each one is used — or that it
is not used at all:
▾ Customer 7 fields · 2 unused
▾ Region 1 calculated column · 1 role · 2 visuals
Customer[Region Long] Calculated column
Sales EU Role · row filter on Customer
Start › Revenue by Region Category
Start › Region Values
▾ CustomerKey 1 relationship · hidden
Sales[CustomerKey] → Customer[CustomerKey] Relationship
Phone not used
Deleted Column not in semantic model · 1 visual
Usages that are detected:
| Usage |
Source |
| Visual |
data roles, visual filters, sorting, conditional formatting |
| Page / report filter |
filter pane of a page or the whole report |
| Measure, calculated column, calculated table |
DAX references in the semantic model |
| Report measure |
DAX of measures defined in the report (reportExtensions.json) |
| Relationship |
both columns of a relationship (inactive ones are marked) |
| Role |
DAX row filters (RLS) and column permissions (OLS) |
| Sort by column |
column used as "Sort by column" of another column |
| Hierarchy |
column used as a hierarchy level |
- Click on a table or field jumps to its definition (the line in the
.tmdl file, model.bim or
reportExtensions.json); click on a usage jumps to it (e.g. the measure, relationship or role filter)
- Fields without any usage are marked not used; the ⊘ button in the search box shows only those
- Fields used in the report but missing in the semantic model are marked not in semantic model
(e.g. a renamed or deleted column that breaks a visual)
- Columns of the automatic date hierarchy are mapped to the underlying date column
- The report is linked to its semantic model via
definition.pbir (byPath). Reports with a live
connection (no local model) are listed separately with only the fields they use
- DAX references are found by text analysis (strings and comments are ignored). Unqualified
references like
[Amount] are resolved to a measure first, then to a column of the same table
- Only this workspace is analyzed: other reports using the same semantic model are not known
Roles tab
Security roles of each semantic model (<Name>.SemanticModel):
▾ Sales Model 2 roles
▾ Sales EU read · 2 table filters · 1 member
Customer [Region] = "EU"
▾ Employees VAR me = USERPRINCIPALNAME() …
Salary column hidden (OLS)
Secret table hidden (OLS)
▾ Members 1
anna@contoso.com AzureAD
- Row-level security: DAX filter per table (full expression in the tooltip)
- Object-level security: hidden tables and columns
- Click on a role, table filter, column permission or member jumps to its line in the role file
- Members, if they are stored in the model (usually they are assigned in the Power BI service)
- Read from
definition/roles/*.tmdl (TMDL) or model.bim (TMSL/JSON)
Search
- Filters live in the active tab: names, visual types, fields, DAX filters, members
- Case-insensitive, partial words match; matches are highlighted
- The path to each match is expanded; content below a match is shown but stays collapsed
- Match count is shown in the search box; the filter stays active while you open files
Ctrl+F in the view or typing in the tree jumps to the search box; Arrow Down/Enter jumps to
the results; Escape or ✕ clears the search
Other
- Refreshes automatically when report or semantic model files change; title bar buttons for
"Collapse All" and "Reload"
- Keyboard: arrow keys (navigate, expand/collapse),
Enter, Home/End
Implementation
Tabs, search box and tree are a single webview (media/reportView.js), styled with the VS Code
theme colors and Codicons (@vscode/codicons, copied to media/codicons during the build).
Problems while loading reports (e.g. unreadable files) are logged to the PBIP Tools
output channel; broken files are skipped instead of breaking the whole tree.
Model diagram
PBIP: Show Model Diagram (Command Palette or the hierarchy button in the title bar of the
Explorer view) opens the tables and relationships of the semantic model in an editor tab:
- Each table is a box with its relationship key columns (●); the footer counts the other columns
and measures. The toolbar toggle shows all columns, calculated columns (ƒ) and measures (Σ)
- Relationships connect the key columns and show the cardinality (
1 / *), the cross filter
direction (arrow, double arrow = both directions); inactive relationships are dashed
- Click a table: highlights the table, all its relationships and the related tables
(everything else is dimmed); the toolbar shows a summary
- Click a relationship: highlights it, both tables and the two key columns
- The clicked table (or column/measure) is also selected in the Fields tab of the Explorer
view, which switches to that tab and expands the table
- Click on empty space or
Escape clears the highlight
- Drag tables to move them (positions are remembered per model, "Reset layout" restores the
automatic layout); drag the background to pan, mouse wheel or
+/- to zoom, 0 to fit
- Click a column, measure or relationship: additionally jumps to its definition (
.tmdl /
model.bim) in an editor beside the diagram; double-click a table header to go to the table
- Several semantic models in the workspace: choose one in the dropdown
- Updates automatically when the model files change
Layout: tables on the "many" side (facts) are placed in the middle, the tables they point to
(dimensions, snowflakes) in columns next to them; tables without relationships go into a grid below.
CSV export
Two commands in the Command Palette (Ctrl+Shift+P), also available in the … menu of the
Explorer view:
| Command |
Content (one row per …) |
| PBIP: Export Field Usage to CSV |
field and usage — all fields of the semantic model, unused ones with status not used: semantic model, table, field, field type, hidden, status, usage type, used in, details, report, page, page ID, page hidden, visual, visual type, visual ID, group, DAX expression, file |
| PBIP: Export Roles to CSV |
table filter (RLS), hidden table/column (OLS) and member: semantic model, role, model permission, entry, table, column, DAX filter, metadata permission, member, identity provider, file |
- The data is reloaded right before the export, so it always reflects the current files
- UTF-8 with BOM, so Excel shows umlauts correctly; multi-line DAX filters are kept in one cell
- Cells starting with
=, +, - or @ are prefixed with ' to prevent formula injection in Excel
- After exporting you can open the file or reveal it in the file explorer
Settings
pbipTools.alignment: left (default) or right
pbipTools.csvDelimiter: ; (default, for Excel with German/European regional settings), , or tab
Build & installation
npm install
npm run package # creates pbip-tools-<version>.vsix
code --install-extension pbip-tools-0.12.7.vsix
Development: press F5 in VS Code to start an Extension Development Host.
| |