Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello!
I'm attempting to build a matrix table that applies custom conditional formatting on a diverging scale using DAX - see example below. I have tried several iterations of DAX using RANKX with no success.
The visual is grouping by 'Product type' and 'RAG rating' and calculating the count of products in each RAG Criteria / count of products in 'Product type' and RAG rating' excluding the RAG criteria. I would then like to rank these values at row level (in the visual) and apply a custom diverging scale based on the RAG rating colour.
An example of the dataset is below
| Product type | Product | Rag criteria | RAG rating |
| Electronics | Television | Total Income | Green |
| Electronics | Television | Gross Margin | Green |
| Electronics | Television | Operational | Amber |
| Electronics | Radio | Total Income | Green |
| Electronics | Radio | Gross Margin | Green |
| Electronics | Radio | Operational | Red |
| Electronics | Laptop | Total Income | Amber |
| Electronics | Laptop | Gross Margin | Amber |
| Electronics | Laptop | Operational | Green |
| Electronics | Speakers | Total Income | Green |
| Electronics | Speakers | Gross Margin | Green |
| Electronics | Speakers | Operational | Green |
| Electronics | Keyboard | Total Income | Red |
| Electronics | Keyboard | Gross Margin | Amber |
| Electronics | Keyboard | Operational | Green |
| Electronics | Headphones | Total Income | Green |
| Electronics | Headphones | Gross Margin | Green |
| Electronics | Headphones | Operational | Amber |
| Furniture | Sofa | Total Income | Amber |
| Furniture | Sofa | Gross Margin | Amber |
| Furniture | Sofa | Operational | Amber |
| Furniture | Armchair | Total Income | Green |
| Furniture | Armchair | Gross Margin | Green |
| Furniture | Armchair | Operational | Amber |
| Furniture | Bed | Total Income | Amber |
| Furniture | Bed | Gross Margin | Amber |
| Furniture | Bed | Operational | Amber |
| Furniture | Table | Total Income | Amber |
| Furniture | Table | Gross Margin | Green |
| Furniture | Table | Operational | Green |
| Furniture | Wardrobe | Total Income | Red |
| Furniture | Wardrobe | Gross Margin | Red |
What are you ultimately trying to convey with the report? Your RAD limits seem very arbitrary.
Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 9 | |
| 6 | |
| 6 |