This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
11-18-2025 10:05 AM - last edited 11-19-2025 04:18 AM
Dynamic Multi-Level Ranking & Hierarchy Percentages with Visual Calculations
This visual demonstrates a fully dynamic Matrix analysis built entirely with Visual Calculations. It supports a multi-level hierarchy (Region → Country → City → Store) and automatically adapts as the user drills up or down.
A Selected Metric field parameter drives all Visual Calculations. All rankings, percentages, and totals dynamically recalculate based on the user’s chosen metric (for example: Value or Row Count).
A lightweight Level Label identifies the current row depth (Region, Country, City, Store) using ISINSCOPE. Each ranking VC returns a value only when the Matrix is at the correct level:
All ranks are formatted using FORMAT() for a clean whole-number display inside the Matrix.
(If you want to apply conditional formatting, remove the FORMAT wrapper inside the VC.)
You can extend the hierarchy to any number of levels by following the exact same pattern.
The model also includes hierarchical percentage calculations:
Both percentage measures are formatted with “0.00%” for clear readability.
Visual Calculation functions used:
RANK, ORDERBY, PARTITIONBY, COLLAPSE, COLLAPSEALL, FORMAT, DIVIDE
This pattern provides a clean, dynamic, drill-aware analytical matrix that can be extended further in future posts.
By Hadi Kheireddine
Have fun exploring Visual Calculations!