Forum Discussion
Conditional Formatting - Multiple Criteria
Hi All,
I am currently trying to implement some conditional formatting based on 3 criteria and would really appreciate some help if possible.
The 3x columns I have:
- Product Profit ($)
- Parts Profit ($)
- Margin (%)
I am trying to complete some colour coding based on the combinations of criteria below
- IF Product Profit ($) = (>0) AND Parts Profit ($) = (>0) AND Margin (%) = (>0) - should be coloured green.
- IF Product Profit ($) = (<0) AND Parts Profit ($) = (>0) AND Margin (%) = (>0) - should be coloured yellow.
- IF Product Profit ($) = (<0) AND Parts Profit ($) = (<0) AND Margin (%) = (<0) - should be coloured red.
Would really appreciate some help or guidance on this!
Try this measure
measure = var _a= min('Table'[Product Profit]) var _b= min('Table'[Parts Profit]) var _c= min('Table'[Margin]) return SWITCH(TRUE(), _a>0 && _b>0 && _c>0,"Green", _a<0 && _b>0 && _c>0,"Yellow", _a<0 && _b<0 && _c<0,"Red")Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- amitchandakSuper User
PThompson1888 , Not able to get the logic. But this logic if you can create a measure, then you can use that in conditional formatting using field value option
example
Switch( True() ,
[Percent] =1 , "Green"
[percent] <.75 , "red",
[percent] <.99 , "Yellow"
)How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4
- PThompson1888Regular Visitor
Hi amitchandak - I have tried to make my logic more clear by updating my initial post. The criteria I would have are 'AND' rather than having the suggestion above which would only take into account one column in my data (margin percent).
Does the updated post clarify a little on what I am trying to do?
- v-xiaotangCommunity Support
Try this measure
measure = var _a= min('Table'[Product Profit]) var _b= min('Table'[Parts Profit]) var _c= min('Table'[Margin]) return SWITCH(TRUE(), _a>0 && _b>0 && _c>0,"Green", _a<0 && _b>0 && _c>0,"Yellow", _a<0 && _b<0 && _c<0,"Red")Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
- PThompson1888Regular Visitor
This worked!!
Thanks so much. - siziHelper II
Hello all,
I have a similar requirement wherein I need to define user's occupancy in a month based on number of projects assigned during the time period. Ex: For January month if a user has 6 projects planned between Jan 5-Jan 25, 1st project is falling between Jan 5th-Jan10th, 2nd & 3rd project between Jan 10-Jan15th and Last 3 project between Jan 16th-Jan 25th, then for the 1st condition, the timeline should be relatively free colored green, for 2nd condition, it should be medium as there's 2 projects and colored yellow and for the last 3 project it should be high colored red and all this needs to defined based on demands and start and end date of task.
Basically If one task then free = green, 2 task then medium =yellow and if user has 3 task and more than highly busy = red based on dates overlap. I need this to be visualised.
Below is the sample data.
Task Number Users Start Date Complete Date 101 John 1/1/2024 5/1/2024 102 John 6/1/2024 11/1/2024 103 John 6/1/2024 11/1/2024 104 John 6/1/2024 11/1/2024 105 John 12/1/2024 17/1/2024 106 John 12/1/2024 17/1/2024 107 John 18/1/22024 23/1/2024 108 John 18/1/22024 23/1/2024 109 John 18/1/22024 23/1/2024 110 John 18/1/22024 23/1/2024 111 John 18/1/22024 23/1/2024 112 John 18/1/22024 23/1/2024 113 Bethany 1/1/2024 4/1/2024 114 Bethany 1/1/2024 4/1/2024 115 Bethany 5/1/2024 6/1/2024 116 Bethany 6/1/2024 11/1/2024 117 Bethany 6/1/2024 11/1/2024 118 Bethany 18/1/22024 23/1/2024 119 Bethany 18/1/22024 23/1/2024 120 Bethany 18/1/22024 23/1/2024 121 Bethany 24/1/2024 30/1/2024 122 Bethany 24/1/2024 30/1/2024 123 Bethany 24/1/2024 30/1/2024 124 Bethany 24/1/2024 30/1/2024 If user a has task >=1 at a time then it shall show green,
If user has task = 2 at a time then it shall show yellow.
And if user has task > 2 at a time then red. All this shall be based on RG start & RG completion date.
If there are 5 user, each user shall have a bar showing his occupancy in either green, yellow or red based based on dates.
KIndly help. Thanks in advance.