Forum Discussion
MikePowerBI
5 months agoHelper II
Conditional Formatting with Different Thresholds per Category
Hi there, I have a matrix (screenshot below) with example data. The matrix takes the median shipment time in days for different shipment categories in different regions. I am looking t...
- 5 months ago
Step 1) Create a color measure
CF Color = VAR _Value = [Median Shipment Days] VAR _Type = SELECTEDVALUE('Shipment'[Type]) RETURN SWITCH( TRUE(), // Air _Type = "Air Shipment" && _Value < 10, "#00B050", -- Green _Type = "Air Shipment" && _Value < 20, "#FFC000", -- Yellow _Type = "Air Shipment" && _Value >= 20, "#C00000", -- Red // Boat _Type = "Boat Shipment" && _Value < 30, "#00B050", _Type = "Boat Shipment" && _Value < 50, "#FFC000", _Type = "Boat Shipment" && _Value >= 50, "#C00000", // Ground _Type = "Ground Shipment" && _Value < 20, "#00B050", _Type = "Ground Shipment" && _Value < 30, "#FFC000", _Type = "Ground Shipment" && _Value >= 30, "#C00000" )Step 2) Apply it in the matrix
- Select your matrix
- Go to Conditional formatting → Background color (or Font color)
- Choose Format by: Field value
- Select CF Color
cengizhanarslan
5 months agoSuper User
Step 1) Create a color measure
CF Color =
VAR _Value = [Median Shipment Days]
VAR _Type = SELECTEDVALUE('Shipment'[Type])
RETURN
SWITCH(
TRUE(),
// Air
_Type = "Air Shipment" && _Value < 10, "#00B050", -- Green
_Type = "Air Shipment" && _Value < 20, "#FFC000", -- Yellow
_Type = "Air Shipment" && _Value >= 20, "#C00000", -- Red
// Boat
_Type = "Boat Shipment" && _Value < 30, "#00B050",
_Type = "Boat Shipment" && _Value < 50, "#FFC000",
_Type = "Boat Shipment" && _Value >= 50, "#C00000",
// Ground
_Type = "Ground Shipment" && _Value < 20, "#00B050",
_Type = "Ground Shipment" && _Value < 30, "#FFC000",
_Type = "Ground Shipment" && _Value >= 30, "#C00000"
)
Step 2) Apply it in the matrix
- Select your matrix
- Go to Conditional formatting → Background color (or Font color)
- Choose Format by: Field value
- Select CF Color
- MikePowerBI5 months agoHelper II
Thank you for your help! This measure solved what I was looking for.