Forum Discussion
DAX code for custom conditional formatting in matrix table
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 |
1 Reply
- lbendlinSuper User
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.