# Power BI Measure Call Graph A Flask web application that visualizes the dependency relationships between measures in a Power BI / Analysis Services model. ## Features - Connect to Analysis Services models - Extract measures and their DAX expressions - Parse DAX expressions to determine dependencies between measures - Visualize the call graph with an interactive D3.js visualization - Search for specific measures - Click on measures to highlight dependencies - Hover over measures to see their DAX expressions ## Requirements - Python 3.7+ - Microsoft Analysis Services ODBC driver (MSOLAP) - Access to a Power BI / Analysis Services model ## Installation 1. Clone this repository: ``` git clone https://github.com/yourusername/pbi-measure-callgraph.git cd pbi-measure-callgraph ``` 2. Create a virtual environment (optional but recommended): ``` python -m venv venv venv\Scripts\activate # Windows source venv/bin/activate # macOS/Linux ``` 3. Install the required packages: ``` pip install -r requirements.txt ``` ## Usage 1. Start the Flask application: ``` python app.py ``` 2. Open your web browser and navigate to: ``` http://localhost:5000 ``` 3. Enter your Analysis Services server and database information and click "Connect" 4. Once connected, the call graph will be displayed with all measures from your model 5. Interact with the graph: - Click on a measure to highlight its dependencies - Hover over a measure to see its DAX expression - Use the search box to find specific measures - Use the mouse wheel to zoom in/out - Drag the graph to pan - Click the "Reset View" button to center the graph ## How It Works 1. **Connection**: The application connects to your Analysis Services model using the MSOLAP ODBC driver 2. **Measure Extraction**: It retrieves all visible measures and their DAX expressions 3. **Dependency Analysis**: The DAX parser analyzes each expression to identify references to other measures 4. **Visualization**: The D3.js force-directed graph visualizes the dependencies between measures ## Troubleshooting - **Connection Issues**: Ensure you have the MSOLAP driver installed and that you have access to the specified server and database - **Missing Measures**: Only visible measures are included in the graph - **Incorrect Dependencies**: The DAX parser uses a simplified approach to identify measure references and may not catch all complex scenarios ## License MIT