HTML Card | Background Color Style

I have an HTML Card that breaks down products by level. In my beast modes I have each level (0-6) set to a particular color as long as the number of accounts is > 0 otherwise it's set to a white background. My code seems to work for every level except for the first, 0, and I can't seem to figure out why.

CASE WHEN COUNT(DIOM Level Acc # (chessboard)) >= 1 THEN

(CASE
WHEN `Level` = 0 THEN
CONCAT('<div style="background=color: #99DBF3; color:black; margin:-20px; padding:20px">', CONCAT('Level 0: Sales $0','<br>', '<span style="font-weight: 800">' ,COUNT(`DIOM Level Acc # (chessboard)`),' Accounts','</span>'),'</div>')

WHEN `Level` = 1 THEN
CONCAT('<div style="background-color: #66CAEE; color:black; margin:-20px; padding:20px">', CONCAT('Level 1: Sales < $2000','<br>', '<span style="font-weight: 800">', COUNT(`DIOM Level Acc # (chessboard)`),' Accounts', '</span>'),'</div>')

WHEN `Level` = 2 THEN
CONCAT('<div style="background-color: #33B8E8; color:black; margin:-20px; padding:20px">', CONCAT('Level 2: Sales < $10,000', '<br>', 'or' ,'<br>','1+ Trained Facilitator','<br>','<span style="font-weight: 800">', COUNT(`DIOM Level Acc # (chessboard)`),' Accounts','</span>'),'</div>')

WHEN `Level`= 3 THEN
CONCAT('<div style="background-color: #00A6E2; color:black; margin:-20px; padding:20px">', CONCAT('Level 3: Sales < $25,000','<br>', 'or', '<br>', '3+ Trained Facilitator','<br>', '<span style="font-weight: 800">',COUNT(`DIOM Level Acc # (chessboard)`),' Accounts', '</span>'),'</div>')

WHEN `Level` = 4 THEN
CONCAT('<div style="background-color: #0094D0; color:white; margin:-20px; padding:20px">', CONCAT('Level 4: Sales < $50,000','<br>','<span style="font-weight: 800">', COUNT(`DIOM Level Acc # (chessboard)`),' Accounts','</span>'),'</div>')

WHEN `Level` = 5 THEN
CONCAT('<div style="background-color: #0082BE; color:white; margin:-20px; padding:20px">',CONCAT('Level 5: Sales < $100,000','<br>','<span style="font-weight: 800">', COUNT(`DIOM Level Acc # (chessboard)`),' Accounts', '</span>'),'</div>')

WHEN `Level` = 6 THEN
CONCAT('<div style="background-color: #006FAD; color:white; margin:-20px; padding:20px">', CONCAT('Level 6: Sales > $100,000','<br>', '<span style="font-weight: 800">', COUNT(`DIOM Level Acc # (chessboard)`),' Accounts', '</span>'),'</div>')
END)

Answers

  • You have a typo in your style

    <div style="background=color

    should be <div style="background-color

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**