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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SnymanGrobler
Frequent Visitor

Compare 2 Columns, Return 3 values

Hi,

I want to compare two columns on the same table.

 

If the Columns match it should return 3.

If thet dont match return 2.

If both are blank return 1.

 

I want to use these values in conditional formatting. 1 for red, 2 for yellow and 3 for green.

 

I have tried this, but it wont return 1. Only returns 2 and 3.

Match = SWITCH(
    TRUE(),
   Table[Column1] = Table[Column2], 3,
   ISBLANK(Table[Column1]) && ISBLANK(Table[Column2]), 1,
    TRUE(), 2
)
 
Can someone please help, thanks.
1 ACCEPTED SOLUTION

@SnymanGrobler 
Try

Match =
SWITCH (
    TRUE (),
    Table[Column1] = BLANK ( ) && Table[Column2] = BLANK ( ), 1,
    Table[Column1] = Table[Column2], 3,
    2
)

or

Match =
SWITCH (
    TRUE (),
    Table[Column1] & Table[Column2] = "", 1,
    Table[Column1] = Table[Column2], 3,
    2
)

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @SnymanGrobler 
Please try

Match =
SWITCH (
    TRUE (),
    ISBLANK ( Table[Column1] ) && ISBLANK ( Table[Column2] ), 1,
    Table[Column1] = Table[Column2], 3,
    2
)

Hi, @tamerj1 

This does not work.

My conditional formatting looks as follows:

SnymanGrobler_0-1687349992985.png

With this logic it still only returns green and yellow colors. Example:

SnymanGrobler_1-1687350064160.png

Do you have any idea why this is the case?

Thanks

 

@SnymanGrobler 
Try

Match =
SWITCH (
    TRUE (),
    Table[Column1] = BLANK ( ) && Table[Column2] = BLANK ( ), 1,
    Table[Column1] = Table[Column2], 3,
    2
)

or

Match =
SWITCH (
    TRUE (),
    Table[Column1] & Table[Column2] = "", 1,
    Table[Column1] = Table[Column2], 3,
    2
)

Thank you very much, second solution worked.

devanshi
Helper V
Helper V

Match = IF(ISBLANK(Table[Column1]) && ISBLANK(Table[Column2]), 1
                       IF(Table[Column1] = Table[Column2], 3, 2)
                   )

SnymanGrobler
Frequent Visitor

@Greg_Deckler Please help

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.