Forum Discussion
Color formatting when text in two different columns are different.
Need to use color to show when text in 2 separate columns are different. Example if Initial Ruling shows "Dismissed" but Final Ruling shows "Not Decided". But other words could be used.
| Initial Ruling (SLH) | Initial Ruling Date | Final Ruling |
| Dismissed | 5/22/2025 | Dismissed |
| Dismissed | 5/6/2025 | Not Decided |
| Dismissed | 5/16/2025 | Dismissed |
| Dismissed | 6/2/2025 | Dismissed |
| Dismissed | 5/1/2025 | Dismissed |
| Dismissed | 2/12/2025 | Dismissed |
| Dismissed | 1/24/2025 | Dismissed |
| Dismissed | 5/23/2025 | Dismissed |
| Dismissed | 4/24/2025 | Not Decided |
| Dismissed | 4/17/2025 | Dismissed |
| Dismissed | 6/2/2025 | Dismissed |
| Dismissed | 5/27/2025 | Dismissed |
| Dismissed | 4/2/2025 | Dismissed |
| Dismissed | 4/2/2025 | Dismissed |
| Dismissed | 2/20/2025 | Dismissed |
| Dismissed | 6/30/2025 | Dismissed |
| Dismissed | 1/30/2025 | Dismissed |
| Dismissed | 4/30/2025 | Dismissed |
| Dismissed | 7/15/2025 | Dismissed |
| Dismissed | 6/9/2025 | Dismissed |
| Dismissed | 4/8/2025 | Dismissed |
| Dismissed | 1/2/2025 | Dismissed |
| Dismissed | 2/4/2025 | Dismissed |
| Dismissed | 5/12/2025 | Dismissed |
| Dismissed | 3/31/2025 | Dismissed |
inglexjc You could create a calculated column like the following and base the conditional formatting on it's value:
Column = IF( [Initial Ruling] = [Final Ruling], 1, 2 )In PQ:
= if [Initial Ruling] = [Final Ruling] then 1 else 2hi inglexjc , You could create a conditional formatting measure:
Conditional Formatting Color = IF ( SELECTEDVALUE ( tbl[Initial Ruling (SLH)] ) <> SELECTEDVALUE ( tbl[Final Ruling] ), "Red", "Yellow" ) --you may use any other color Power BI can interpret but a safer method is to use RGB, RGBA or Hexadecimal colorsNote: SELECTEDVALUE returns blank if in the current row there are more than one values for the column being referenced so ensure to use a column that will return just a single ruling value for each ruling column (like a case number, etc).
you created a column instead of a measure.
6 Replies
- Greg_DecklerCommunity Champion
inglexjc You could create a calculated column like the following and base the conditional formatting on it's value:
Column = IF( [Initial Ruling] = [Final Ruling], 1, 2 )In PQ:
= if [Initial Ruling] = [Final Ruling] then 1 else 2 - danextianSuper User
hi inglexjc , You could create a conditional formatting measure:
Conditional Formatting Color = IF ( SELECTEDVALUE ( tbl[Initial Ruling (SLH)] ) <> SELECTEDVALUE ( tbl[Final Ruling] ), "Red", "Yellow" ) --you may use any other color Power BI can interpret but a safer method is to use RGB, RGBA or Hexadecimal colorsNote: SELECTEDVALUE returns blank if in the current row there are more than one values for the column being referenced so ensure to use a column that will return just a single ruling value for each ruling column (like a case number, etc).
- inglexjcPost Patron
When I do this:
Conditional Formatting Color =IF (SELECTEDVALUE ( '4HearingsAppeals Items'[Initial Ruling (SLH) (status_color_mknhxvfd)] )<> SELECTEDVALUE ( '4HearingsAppeals Items'[Final Ruling (SLH) (status_color_mkp6fvmp)] ),"Red","Blue"And chose it as the conditional formating:It's not working correctly, see about 4th line down should be RED.
What am I doing wrong?
- danextianSuper User
you created a column instead of a measure.
- burakkaragozSuper User
Hi inglexjc ,
Both solutions work, but I'd go with Greg_Deckler 's approach - it's simpler and more reliable.
The calculated column method:
RulingMatch = IF([Initial Ruling] = [Final Ruling], 1, 0)
Then use this column for conditional formatting:
- Value = 1 → Green (matching)
- Value = 0 → Red (different)
Why this is better than the measure approach: The SELECTEDVALUE measure can get tricky if your table visual has any grouping or if there are multiple rows with the same values. The calculated column approach works consistently regardless of how your visual is set up.
Power Query version (if you prefer doing it there):
= if [Initial Ruling] = [Final Ruling] then "Match" else "Different"
Then color format based on "Match" vs "Different".
For your conditional formatting:
- Select your Initial Ruling or Final Ruling column
- Format → Conditional formatting → Background color
- Format by: Field value (use your new calculated column)
- Set colors: 1 = Green, 0 = Red
This way you get a clear visual indication whenever the rulings don't match, which seems to be what you're looking for.
The calculated column approach is bulletproof and works in any visual configuration.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.- inglexjcPost Patron
When I do:
RulingMatch =IF ( '4HearingsAppeals Items'[Initial Ruling (SLH) (status_color_mknhxvfd)] = '4HearingsAppeals Items'[Final Ruling (SLH) (status_color_mkp6fvmp)], 1, 0)The new column is working correctly. But the conditional formating is not working. It doesn't give me "RulingMatch" as an option. It's grayed out:If I try the other way I get an error:
Thoughts?