Forum Discussion
Conditional Formatting compare with 2 Columns
Hello Team,
I have mutliple columns in a table, below are the few columns on which i need conditional formatting in Badge Column.
Current Badge:
| Platinum |
| Gold |
| Silver |
| Bronze |
Previous Badge:
| Platinum |
| Gold |
| Silver |
Bronze |
Region
| A1 |
| E1 |
| A2 |
User
| User1 |
| User2 |
| User3 |
| User4 |
| User5 |
| User6 |
| User7 |
| User8 |
I created a Matrix table in PowerBI and moved all above columns.
Name & Region in Rows
Badge and Previous Badge as Value (First). It looks like below
| Name | Region | Badge | Prev_badge |
| User1 | A1 | Platinum | |
| User2 | A1 | Platinum | Silver |
| User3 | E2 | Platinum | Gold |
| User4 | E2 | Platinum | Silver |
| User5 | A2 | Platinum | |
| User6 | A2 | Platinum | Gold |
| User7 | E2 | Gold | Bronze |
| User8 | A2 | Silver | Bronze |
Now, i need a conditional formatting on Badges:
If Badge is Platinum and Previous Badge is Blank, then we can color it as Yellow.
If Badge & Previous is Platinum, then we need to color it as white.
If Badge is Platinum & Previous Badge is Silver, Bronze or Gold, then we need to color it as Green. Like below:
We tried creating this in PowerBI, but it is marking green for everything. Please help.
Regards
Arun
Hello arun2001mjl , create a measure and then apply that measure in the conditional formatting under field values.
Measure looks as below:
Conditional Formating =
IF(Prev_Badge = BLANK() && Badge = "Platinum","Yellow",
IF(Prev_Badge = "Platinum" && Badge = "Platinum","White",
IF((Prev_Badge = "Gold"||Prev_Badge = "Silver"||Prev_Badge = "Bronze")&& Badge = "Platinum", "Green", BLANK())))If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!
3 Replies
- Kishore_KVNSolution Sage
Hello arun2001mjl , create a measure and then apply that measure in the conditional formatting under field values.
Measure looks as below:
Conditional Formating =
IF(Prev_Badge = BLANK() && Badge = "Platinum","Yellow",
IF(Prev_Badge = "Platinum" && Badge = "Platinum","White",
IF((Prev_Badge = "Gold"||Prev_Badge = "Silver"||Prev_Badge = "Bronze")&& Badge = "Platinum", "Green", BLANK())))If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!
- arun2001mjlHelper II
Thank you. Previous Badge column is calculated column which was vlookedup from another table to the main table. Since it is a calculated column, we are unable to create measure.
- Kishore_KVNSolution Sage
No, that shouldnt be the case even on a calculated column you can do that. If you are facing any error can you please share that error and let us know what you are facing.