Assigning red Font color in a beastmode - Single Value Card

I have a single value card and I'm using the following code to format the dollar value as I concatenate several values into one text value for the card to display. Do you know if there's a way to have the font color display red if the value is negative? Here's a snippet of the code:

CONCAT(
'$',
CASE
WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 10 THEN /xxx million/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 4, 3),'M')

WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 9 THEN /xx million/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3, 3),'M')

WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 8 THEN /x million/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 1),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2, 3),'M')

WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 7 THEN /xxx thousand/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 4, 2),'K')

WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 6 THEN /xx thousand/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3, 2),'K')

WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 5 THEN /x thousand/
CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 1),'.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2, 2),'K')

ELSE CAST(Round(Talacki $ (S) TY - ALL BU,0) AS CHAR)
END
, ' TY',' | '

I haven't attempted Domo Bricks yet… might be something that I have to learn. Would love any guidance here or direction on how to achieve this. I have a string of 6 values that looks something like this:

Total Seasonal Performance

TY$ | LY$ | VAR $ |VAR %

Plan $ | VAR $ to Plan | % to Plan

Thanks in advance!

Answers

  • I'm not sure if you can do conditional formatting on a value card. I'm not where I can test it.

    In a card that allows html like a brick, you could do something like

    CONCAT(
    CASE
    WHEN Talacki $ (S) TY - ALL BU < 0 THEN '<span style="color:red;">$'
    ELSE '$'
    END,
    CASE
    WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 10 THEN -- xxx million
    CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 4, 3), 'M')
    WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 9 THEN -- xx million
    CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3, 3), 'M')
    WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 8 THEN -- x million
    CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 1), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2, 3), 'M')
    WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 7 THEN -- xxx thousand
    CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 4, 2), 'K')
    WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 6 THEN -- xx thousand
    CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 3, 2), 'K')
    WHEN INSTR(CAST(Talacki $ (S) TY - ALL BU AS CHAR), '.') = 5 THEN -- x thousand
    CONCAT(LEFT(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 1), '.', SUBSTRING(CAST(Talacki $ (S) TY - ALL BU AS CHAR), 2, 2), 'K')
    ELSE
    CAST(Round(Talacki $ (S) TY - ALL BU, 0) AS CHAR)
    END,
    CASE
    WHEN Talacki $ (S) TY - ALL BU < 0 THEN '</span>'
    ELSE ''
    END,
    ' TY', ' | '
    )

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

  • Grrr…I can't seem to response to this question. My responses aren't showing up. Perhaps a graphic will work. For cards with html capability….

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