An interactive web-based tool for visualizing measure dependencies in Power BI TMDL (Tabular Model Definition Language) files.
- Interactive Graph Visualization: View all measures and their dependencies as a directed graph
- Hierarchical Layout: Automatic layout showing the flow of dependencies
- Measure Details: Click on any measure to view:
- DAX formula
- Format string
- Display folder
- Dependencies list
- Search & Filter:
- Search measures by name
- Filter by table
- Highlighting: Double-click a measure to highlight all its dependencies
- Export: Export the diagram as PNG image
- Responsive Design: Modern, clean interface with smooth animations
Sales Dashboard.SemanticModel/
├── definition/
│ └── tables/ # TMDL table files with measure definitions
│ ├── Fact_Sales.tmdl
│ ├── Dim_Dates.tmdl
│ ├── tbl_Measures.tmdl
│ └── ...
├── tmdl_parser.py # Python script to parse TMDL files
├── measures_data.json # Generated JSON with measures and dependencies
├── index.html # Main web interface
├── measure_visualizer.js # JavaScript for graph visualization
└── README.md # This file
- Python 3.6 or higher
- A modern web browser (Chrome, Firefox, Edge, Safari)
Run the Python parser to extract measures and analyze dependencies:
cd "c:\Users\marce\Downloads\PBIP File\Sales Dashboard.SemanticModel"
python tmdl_parser.pyThis will:
- Scan all
.tmdlfiles indefinition/tables/ - Extract measure definitions
- Analyze DAX formulas to find dependencies
- Generate
measures_data.json
Open index.html in your web browser:
# On Windows
start index.html
# Or simply double-click index.html in File ExplorerThe visualizer will automatically load the data from measures_data.json.
- Pan: Click and drag on the background
- Zoom: Use mouse wheel or navigation buttons
- Select Measure: Click on any node
- Highlight Dependencies: Double-click on a measure node
- Search: Type a measure name to quickly find and focus on it
- Table Filter: Filter measures by their parent table
- Reset View: Clear all selections and show all measures
- Fit to Screen: Adjust zoom to show all visible measures
- Export PNG: Download the current view as an image
- Blue nodes: Regular measures
- Red node: Currently selected measure
- Green nodes: Dependencies of the selected measure
- Arrows point from a measure to the measures it depends on
- The direction shows the dependency flow
- Open the tool in your browser
- Use the search box to find "Total Sales"
- Click on the measure to see its details
- Double-click to highlight all its dependencies
- Click on a dependency in the sidebar to navigate to it
- Export the diagram if needed
The parser understands the following TMDL measure structure:
table TableName
measure 'Measure Name' =
DAX_FORMULA
formatString: #,0
displayFolder: 2-Measures\Sales
lineageTag: unique-id- name: The measure name
- table: Parent table name
- formula: Complete DAX formula
- formatString: Number/date formatting
- displayFolder: Organizational folder path
- lineageTag: Unique identifier
- dependencies: List of other measures referenced
The parser identifies dependencies by:
- Scanning DAX formulas for measure references:
[MeasureName] - Matching references against known measures
- Building a directed graph of dependencies
measure 'Sales Full LY' =
VAR _MinDate = [MinDate LY]
VAR _MaxDate = [MaxDate LY]
RETURN
CALCULATE(
[Total Sales],
FILTER(...)
)
Dependencies detected: MinDate LY, MaxDate LY, Total Sales
Edit tmdl_parser.py to:
- Add support for additional measure properties
- Customize dependency detection logic
- Change output format
Edit the <style> section in index.html to:
- Change color scheme
- Adjust layout parameters
- Modify fonts and spacing
Edit measure_visualizer.js to customize:
- Layout algorithm (hierarchical, force-directed, etc.)
- Node shapes and sizes
- Edge styles
- Interaction behaviors
Current model contains:
- 56 measures across 8 tables
- 27 measures have dependencies
- Maximum dependencies per measure: 3
- Fact_Sales: 27 measures
- Dim_Dates: 8 measures
- Dim_Agents: 6 measures
- Dim_Products: 4 measures
- Dim_Customers: 3 measures
- Parameter_SalesAndProfit: 3 measures
- factBikesSales: 3 measures
- tbl_Measures: 2 measures
Solution:
- Ensure
measures_data.jsonexists - Check browser console for errors
- Verify you're opening via HTTP (not file://) or use a local server
Solution:
- Check if measure references use square brackets:
[MeasureName] - Verify measure names match exactly (case-sensitive)
- Run the parser again to regenerate data
Solution:
- Verify Python is installed:
python --version - Ensure you're in the correct directory
- Check file paths in the script
When your TMDL files change:
-
Re-run the parser:
python tmdl_parser.py
-
Refresh the browser (F5) to reload the visualization
- Backend: Python 3 with standard libraries
- Frontend: Vanilla JavaScript (ES6+)
- Visualization: vis.js network library
- Styling: Modern CSS with gradients and animations
- Chrome/Edge: ✅ Full support
- Firefox: ✅ Full support
- Safari: ✅ Full support
- IE11: ❌ Not supported
- Performance: For models with 100+ measures, filtering by table helps
- Navigation: Use keyboard shortcuts (arrow keys) to navigate
- Export: Export before making changes for documentation
- Analysis: Look for measures with many dependencies - they might be good candidates for optimization
This tool is provided as-is for analyzing TMDL files. Modify and use as needed.
To extend this tool:
- Fork or copy the project
- Make your modifications
- Test with your TMDL files
- Share improvements!
For issues or questions:
- Check the console for JavaScript errors
- Verify TMDL file format matches expectations
- Review the parser output for warnings
Happy visualizing! 📊✨