Forum Discussion
dhrupal_shah
1 year agoHelper I
Conditional formatting not applied
Dear All, created matrix visual from sql data which contain more than 20 column. i want to conditional fomatting on column name based. please refer my below code and screen shot. as per conditio...
- Anonymous1 year ago
Hi dhrupal_shah ,
You can try the following measure.
Measure = VAR _sum = SUM('Production'[QtyRecv]) RETURN SWITCH( TRUE(), TRIM(MAX('Production'[ComponentName])) = "CTL 1" && _sum > 50 , "#008000", // Green TRIM(MAX('Production'[ComponentName])) = "CTL 1" && _sum >=35 && _sum <= 50, "#000a00", // Black TRIM(MAX('Production'[ComponentName])) = "CTL 1" && _sum > 0 && _sum < 35, "#FF0000" //Red )Also, depending on whether you want all columns to have conditional formatting added to them? If so, just remove the condition “TRIM(MAX(‘Production’[ComponentName])) = ‘CTL 1’”
More detailed information can be found in the attachment.
Best Regards,
Clara Gong
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
PhilipTreacy
1 year agoSuper User
Hi dhrupal_shah
Download PBIX file with the example below
You don't need to name the column in the measure, you apply the measure to the column as conditional formatting using this DAX
Production_Color =
VAR _QtyRecv = SELECTEDVALUE(Production[QtyRecv])
RETURN
SWITCH(
TRUE(),
_QtyRecv > 50 , "#008000", // Green
_QtyRecv >=35 && _QtyRecv <= 50, "#000a00", // Black
_QtyRecv > 0 && _QtyRecv < 35, "#FF0000" //Red
)
Regards
Phil