This repository contains a custom Power BI visual for creating Sankey diagrams with up to 8 levels.
You need the .pbiviz file to import this visual into Power BI. Here's how to get it:
# 1. Navigate to the visual directory
cd powerbi-sankey-8level
# 2. Install dependencies (first time only)
npm install
# 3. Build the package
npm run packageThe visual file will be created at: powerbi-sankey-8level/dist/powerbi-sankey-8level.1.0.0.pbiviz
Check the Releases page for pre-built .pbiviz files.
- Node.js (v18 or higher) - Download here
- Power BI Visuals Tools:
npm install -g powerbi-visuals-tools
- Power BI Desktop - Download here
cd powerbi-sankey-8level
npm install
npm run package- Open Power BI Desktop
- Go to Visualizations pane
- Click the three dots (...) → "Import a visual from a file"
- Select:
powerbi-sankey-8level/dist/powerbi-sankey-8level.1.0.0.pbiviz - Click Import
- Accept the security warning
The Sankey visual icon will now appear in your Visualizations pane! ✅
Your data needs at least:
- Level1 column (text) - First stage in the flow
- Value column (number) - Flow magnitude
| Level1 | Level2 | Level3 | Value |
|---|---|---|---|
| Intake | Triage | Resolve | 120 |
| Intake | Triage | Escalate | 40 |
| Intake | Bypass | Resolve | 10 |
- Click the Sankey visual icon to add it to your report
- Drag fields to the visual:
- Level1-8: Your stage/category columns
- Value: Your numeric measure
- Tooltip: (optional) Custom tooltip text
- Adjust formatting settings as needed
- DEPLOYMENT_GUIDE.md - Complete deployment instructions
- CODE_REVIEW.md - Code review and quality analysis
- powerbi-sankey-8level/README.md - Technical details
cd powerbi-sankey-8level
npm install
npm run startThis starts a dev server. In Power BI Desktop (with Developer Mode enabled), the visual will auto-reload when you make changes.
powerbi-sankey-8level/
├── src/
│ ├── visual.ts # Main visual logic
│ └── settings.ts # Visual settings
├── style/
│ └── visual.less # Styling
├── assets/
│ └── icon.png # Visual icon
├── capabilities.json # Data roles and capabilities
├── pbiviz.json # Visual metadata
└── package.json # Dependencies
npm run start- Start development servernpm run package- Create.pbivizpackage file
- ✅ Up to 8 levels of flow visualization
- ✅ Simple table (row-column) data input
- ✅ Configurable node width, padding, and alignment
- ✅ Label truncation to prevent overlap
- ✅ Optional label merging across levels
- ✅ Custom tooltips
- ✅ Interactive hover states
npm install -g powerbi-visuals-toolsrm -rf node_modules dist
npm install
npm run package- Ensure you've added at least Level1 and Value fields
- Check that Value contains valid positive numbers
- Verify no circular flows (A→B→A not allowed)
✅ Fixed Critical Bugs:
- maxLevel calculation bug
- Settings property access logic
- Added error handling and validation
- Improved TypeScript type safety
📊 Code Quality: Improved from ⭐⭐⭐ (3/5) to ⭐⭐⭐⭐ (4/5)
See CODE_REVIEW.md for complete details.
- Fork the repository
- Make your changes
- Test thoroughly
- Submit a pull request
See LICENSE file for details.
Need Help? Check the DEPLOYMENT_GUIDE.md for detailed instructions and troubleshooting.