Color Coding or conditional formatting in DOMO?

gbrown
gbrown Member
edited May 2023 in SQL DataFlows

I am trying to make a scorecard for budget…etc… Let's say our budget in Jan was $14,418,053 and are actuals were below that. How could I turn that budget red? and vice versa if actuals were above budget it would be green? Is this possible in DOMO yet or are there work arounds.

Thanks,

Garrett

Best Answers

Answers

  • MarkSnodgrass
    Answer ✓

    If you are using a mega table, you can create beast modes that color the numbers like this:

    CASE WHEN budget > actual then concat('<div style="color: #ff0000">',`budget`,'</div>')
    
    else
    
    concat('<div style="color: #00ff00">',`budget`,'</div>')
    
    end
    

    This would turn the budget red if it is higher, otherwise it will be green.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • gbrown
    gbrown Member

    Thank you for this. This looks like this will be able to help. In the beastmode what do I need to change? It seems to be brining the budget over but not the color.

    CASE WHEN SUM(Budget) > SUM(Amount) then concat('',SUM(Budget),'')

    else

    concat('',SUM(Budget),'')

    end

  • gbrown
    gbrown Member
  • MarkSnodgrass
    Answer ✓

    Try switching to the HTML table chart type and see if that works.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • gbrown
    gbrown Member

    Great that worked! One last thing is it will not format to currency I am assuming because it comes in as a text. Is there work around this or is this as detailed as DOMO's beastmodes can get

  • MarkSnodgrass
    Answer ✓

    You can construct the format through some elaborate beast mode syntax, but it will still be viewed as text. If you search the community for beast mode formatting, you should see some examples. You could add a round function to eliminate pennies very easily, but the commas and $ signs require an elaborate beast mode.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • gbrown
    gbrown Member

    Thanks @GrantSmith !

    This beastmode helped with removing decimals and still kept the color conditions active. What is the correct way to format this beastmode to be able to have commas in the value?

    Thanks

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    You can replace the FLOOR(SUM(`random_number`)) on line 11 in the example with the beast mode that will format the value with commas. You can refer to the Number Formatting link I sent earlier.

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

    Worked great! Thank y'all for the help!

  • @gbrown Glad to hear it! If you could accept any answers that helped solved your problem so others can easily find the answers I'd appreciate it!

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • LMartin
    LMartin Member
    edited March 18

    Hello,
    Can I use the HTML syntax to put colors in a pivot table with beastmode?
    I'm trying to do a formula like:

    CASE
    WHEN AVG(SLA Calculation) >= 0.9 THEN concat('<div style="color: #ff0000">',AVG(SLA Calculation),'</div>')
    ELSE concat('<div style="color: #00ff00">',AVG(SLA Calculation),'</div>')
    END