Case statement with multiple field conditions

Hi - I'm looking for a Case statement that will provide multiple conditions and multiple "then" statements but keep getting an error. 

I've tried multiple versions but none have worked. 

 

Examples below:

CASE(`Impact Rank`)
WHEN <(`BDS Rank TW`)THEN CONCAT('<span style="background-color: #00A86B">','OUTPERFORMING')
WHEN =(`BDS Rank TW`)THEN CONCAT('<span style="background-color: #00A86B">','PERFORMING')
ELSE CONCAT('underperforming')
END

 

CASE((`Impact Rank`)
WHEN <(`BDS Rank TW`)
THEN CONCAT('<span style="background-color: #00A86B">','OUTPERFORMING')
WHEN =(`BDS Rank TW`)
THEN CONCAT('<span style="background-color: #00A86B">','PERFORMING')
ELSE CONCAT('underperforming')
END

 

CASE WHEN((`Impact Rank`)<`BDS Rank TW`)
THEN CONCAT('<span style="background-color: #00A86B">','OUTPERFORMING')
ELSE CONCAT('underperforming')
CASE WHEN((`Impact Rank`)=`BDS Rank TW`)
THEN CONCAT('<span style="background-color: #00A86B">','PERFORMING')
ELSE CONCAT('underperforming')
END

Best Answer

  • Property_Ninja
    Property_Ninja Contributor
    Answer ✓

    sorry I had an extra parentheses. Try this ...

     

    CASE
    WHEN `Impact Rank` < `BDS Rank TW`

    THEN CONCAT('<span style="background-color: #00A86B">','OUTPERFORMING')
    WHEN Impact Rank` = `BDS Rank TW`

    THEN CONCAT('<span style="background-color: #00A86B">','PERFORMING')
    ELSE 'UNDERPERFORMING' 

    END


    **Please mark "Accept as Solution" if this post solves your problem
    **Say "Thanks" by clicking the "heart" in the post that helped you.

Answers

  • Hello,

     

    Can you try something like this ... 

     

    CASE(
    WHEN `Impact Rank` < `BDS Rank TW`

    THEN CONCAT('<span style="background-color: #00A86B">','OUTPERFORMING')
    WHEN Impact Rank` = `BDS Rank TW`

    THEN CONCAT('<span style="background-color: #00A86B">','PERFORMING')
    ELSE 'UNDERPERFORMING' 

    END

     

    Let me know if this helps,

     

    Brian


    **Please mark "Accept as Solution" if this post solves your problem
    **Say "Thanks" by clicking the "heart" in the post that helped you.
  • Property_Ninja
    Property_Ninja Contributor
    Answer ✓

    sorry I had an extra parentheses. Try this ...

     

    CASE
    WHEN `Impact Rank` < `BDS Rank TW`

    THEN CONCAT('<span style="background-color: #00A86B">','OUTPERFORMING')
    WHEN Impact Rank` = `BDS Rank TW`

    THEN CONCAT('<span style="background-color: #00A86B">','PERFORMING')
    ELSE 'UNDERPERFORMING' 

    END


    **Please mark "Accept as Solution" if this post solves your problem
    **Say "Thanks" by clicking the "heart" in the post that helped you.
  • THANK YOU! 

     

    That worked perfectly.