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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Ak_Pikachu
Frequent Visitor

Conditional Formatting based on text fields_Help

Hi All,

I have two text columns from two tables suppose A and B.
I want to display a text column from table A in a matrix visual, 

My question is if table A have values different from table B show those difference in Red Color, conditional formatting


Please help me
Example: 
Table A

1A
2B
3c
4D
5E

Table B:

1A
2B
3C
4D

 

Final O/P:

1A
2B
3C
4D
5E

@parry2k , @amitchandak  

2 ACCEPTED SOLUTIONS
parry2k
Super User
Super User

@Ak_Pikachu if ID in TableA and TableB is unique and has a relationship, add following DAX measure for color and use it in the conditional formatting:

 

Color = 
VAR __tableAValue = SELECTEDVALUE ( TableA[Value] )
VAR __tableBValue = SELECTEDVALUE ( TableB[Value] )
RETURN
IF ( __tableAValue <> __tableBValue, "Red" )

 

parry2k_0-1665695236812.png

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

parry2k
Super User
Super User

@Ak_Pikachu add a new measure something like this and use this in the card visual:

 

Diff = 
VAR __diff = 
SUMX ( 
    TableA,  
    VAR __tableAValue = SELECTEDVALUE ( TableA[Value] )
    VAR __tableBValue = SELECTEDVALUE ( TableB[Value] )
    RETURN IF ( __tableAValue <> __tableBValue, 1, 0 )
)
RETURN 
IF ( __diff = 0,  "Everything Ok", "Correct the values" )

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

9 REPLIES 9
parry2k
Super User
Super User

@Ak_Pikachu add a new measure something like this and use this in the card visual:

 

Diff = 
VAR __diff = 
SUMX ( 
    TableA,  
    VAR __tableAValue = SELECTEDVALUE ( TableA[Value] )
    VAR __tableBValue = SELECTEDVALUE ( TableB[Value] )
    RETURN IF ( __tableAValue <> __tableBValue, 1, 0 )
)
RETURN 
IF ( __diff = 0,  "Everything Ok", "Correct the values" )

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k ,

It is showing the same result in both conditions in a card visual, Working fine in a Table visual along with Names.

Please help if there is a way to achieve this

Ak_Pikachu
Frequent Visitor

Thank yo so much, It worked

I have another question, I want to display a text box visual, on condition basis

If none of values in Red: "Everything Ok"
If some values in Red: "Correct the Values"

I tried writing the text in the same dax you sent, Its working in a table visual alng with the Column

But I need a text box visual conditionally

Please Help

parry2k
Super User
Super User

@Ak_Pikachu Ok what is the relationship type between these tables? one to one, one to many, if it is one to many which table is on the many sides? it is not about id columns, it is more about if these tables have relationships.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Ak_Pikachu if ID in TableA and TableB is unique and has a relationship, add following DAX measure for color and use it in the conditional formatting:

 

Color = 
VAR __tableAValue = SELECTEDVALUE ( TableA[Value] )
VAR __tableBValue = SELECTEDVALUE ( TableB[Value] )
RETURN
IF ( __tableAValue <> __tableBValue, "Red" )

 

parry2k_0-1665695236812.png

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k ,

I have another question, I want to display a text box visual, on condition basis

If none of values in Red: "Everything Ok"
If some values in Red: "Correct the Values"

I tried writing the text in the same dax you sent, Its working in a table visual alng with the Column

But I need a text box visual conditionally

Please Help

Sorry for the wrong info, I have no ID column which has relation blw two tables,

There a relation but that is also a Text field

parry2k
Super User
Super User

@Ak_Pikachu the first column (ID) is unique in both the tables?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors