Forum Discussion
conditionally formatting by column
Hi mogugu_84
To achieve this you need to create a measure for backgroud color of 3M for column P only not the L.
Try code pattern below for your case:
If single color:
RevenueColor =
SWITCH(
TRUE(),
SELECTEDVALUE('Calendar'[Quarter]) IN {1, 2}, "#FFCCCB", // Light Red for Q1 and Q2
BLANK() // No color for other quarters
)
If gradient color scale:
RevenueGradientColor =
SWITCH(
TRUE(),
SELECTEDVALUE('Calendar'[Quarter]) IN {1, 2},
VAR RevenueValue = [Revenue]
RETURN
IF(
RevenueValue <= 100000, "#FFCCCB",
IF(
RevenueValue <= 500000, "#FF9999",
"#FF6666"
)
),
BLANK() // No color for other quarters
)
Go to cell element > select measure (In your case 3M) > turn on background color > click fx > select field value > and select newly created measure. See image:
Output:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Bes Regards,
Shahariar Hafiz
- mogugu_841 year agoHelper I
Hi Shafiz
thank you! however, sorry i didn't explain the measure of "3M" properly, it is a calculated value for rolling 3 months vs LY, i.e. Oct 24+Sep 24+Aug 24 vs Oct 23+Sep 23+Aug 23....so the formulas containing 'calendar[quarter]' would not work.....plus i also need to replicate this conditional format process for the value of "Fiscal year to date vs LY, and rolling 12 months vs LY too......
- shafiz_p1 year agoSuper User
The formula I have provided is just an example, how could you color background of specific measure of a specific column. It does not matter how your measure is evaluating. It is a matter which column and which measure. You can compare measure with other measure or fixed value for gradient color scale. As I understood from your post. Also, calendar[quarter] is my column name to demonastrate the scenario. Your column name is different (from the picture, i can see it is molecule). You need to replace column name and measure name accordingly.
Hope you got the point.