Forum Discussion

arun2001mjl's avatar
arun2001mjl
Helper II
3 years ago
Solved

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

NameRegionBadgePrev_badge
User1A1Platinum 
User2A1PlatinumSilver
User3E2PlatinumGold
User4E2PlatinumSilver
User5A2Platinum 
User6A2PlatinumGold
User7E2GoldBronze
User8A2SilverBronze

 

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

  • 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!!

  • 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_KVN's avatar
      Kishore_KVN
      Solution 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.