Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
inglexjc
Post Patron
Post Patron

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 DateFinal Ruling 
Dismissed5/22/2025Dismissed
Dismissed5/6/2025Not Decided
Dismissed5/16/2025Dismissed
Dismissed6/2/2025Dismissed
Dismissed5/1/2025Dismissed
Dismissed2/12/2025Dismissed
Dismissed1/24/2025Dismissed
Dismissed5/23/2025Dismissed
Dismissed4/24/2025Not Decided
Dismissed4/17/2025Dismissed
Dismissed6/2/2025Dismissed
Dismissed5/27/2025Dismissed
Dismissed4/2/2025Dismissed
Dismissed4/2/2025Dismissed
Dismissed2/20/2025Dismissed
Dismissed6/30/2025Dismissed
Dismissed1/30/2025Dismissed
Dismissed4/30/2025Dismissed
Dismissed7/15/2025Dismissed
Dismissed6/9/2025Dismissed
Dismissed4/8/2025Dismissed
Dismissed1/2/2025Dismissed
Dismissed2/4/2025Dismissed
Dismissed5/12/2025Dismissed
Dismissed3/31/2025Dismissed
3 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community 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


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

danextian
Super User
Super 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 colors

Note: 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).

danextian_0-1754020985616.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

you created a column instead of a  measure. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
burakkaragoz
Community Champion
Community Champion

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:

  1. Select your Initial Ruling or Final Ruling column
  2. Format → Conditional formatting → Background color
  3. Format by: Field value (use your new calculated column)
  4. 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.

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:
inglexjc_0-1754054957790.png

If I try the other way I get an error:

inglexjc_1-1754055012866.png

Thoughts?

danextian
Super User
Super 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 colors

Note: 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).

danextian_0-1754020985616.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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:
inglexjc_2-1754055195196.png

It's not working correctly, see about 4th line down should be RED.

inglexjc_3-1754055250772.png

What am I doing wrong?

you created a column instead of a  measure. 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Greg_Deckler
Community Champion
Community 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


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.