PBIR Utils
pbir-utils is a Python library designed to streamline the tasks that Power BI developers typically handle manually in Power BI Desktop. This module offers a range of utility functions to efficiently manage and manipulate PBIR (Power BI Enhanced Report Format) metadata.
โจ Features
Core Utilities
- ๐ Web UI: Interactive browser-based interface for reports, wireframes, and actions
- ๐ Extract Metadata: Export metadata from PBIR files to CSV
- ๐ผ๏ธ Wireframe Visualizer: Visual report layout with zoom, search, and field tracking
- โ Validate Report: Rule-based validation with custom expression support
- ๐งน Sanitize Report: Clean up and optimize reports with YAML configuration
Report Management
- โ Disable Interactions: Bulk disable interactions between visuals
- ๐งผ Remove Measures: Remove unused report-level measures
- ๐ Measure Dependencies: Extract measure dependency trees
- ๐ Remove Unused Bookmarks: Clean up orphaned bookmarks
- ๐จ Remove Unused Visuals: Remove unused custom visual registrations
Filters & Pages
- ๐ Update Filters: Modify report-level filter conditions
- ๐ข Sort Filters: Reorder filter pane items
- โ๏ธ Configure Filter Pane: Control pane visibility and state
- ๐ Set Page Size: Set page dimensions for all pages
- ๐ Hide Tooltip Pages: Auto-hide tooltip and drillthrough pages
๐ฆ Installation
For the web UI, install with optional dependencies:
๐ Quick Start
After installation, the pbir-utils CLI is available:
# Launch interactive web UI
pbir-utils ui
# Sanitize a report with default actions (dry-run to preview)
pbir-utils sanitize "C:\Reports\MyReport.Report" --dry-run
# Validate against best practices
pbir-utils validate "C:\Reports\MyReport.Report"
# Extract metadata to CSV
pbir-utils extract-metadata "C:\Reports\MyReport.Report"
# Visualize report wireframes
pbir-utils visualize "C:\Reports\MyReport.Report"
Or use the Python API:
import pbir_utils as pbir
# Validate a report
result = pbir.validate_report(r"C:\Reports\MyReport.Report", strict=False)
print(result) # "5 passed, 0 errors, 2 warnings"
# Sanitize a report
pbir.sanitize_powerbi_report(r"C:\Reports\MyReport.Report", dry_run=True)
๐ Next Steps
- CLI Reference - Detailed command-line usage
- Python API - Python library documentation
- CI/CD Integration - Pipeline integration and validation