Conditional formatting


Hello Members, I have this unique situation where I need to show both Actuals and Plan bars ( preferred). But if my Actuals are less than 25 % of the Plan ( which is true in this screenshot ) , I want to show Actuals bar as red color.. I am open to switch to different chart but at the end I want Actuals to be shown in red if it is less than 25% of Plan.


Thank You!



Tagged:

Best Answers

  • jaeW_at_Onyx
    jaeW_at_Onyx Coach
    Answer ✓

    @faisalnjit

    1) i would recommend a different visualization. consider the Bullet Chart which was designed to show target vs. actuals. by having data spread across two axis you force users to compare something in a way that may not be intuitive.


    By stacking Actuals and Plan into the same column of your data you've made it slightly more difficult to use the bullet chart and impossible to compare Actuals vs. Plan without using window function in your current chart type.

    SOLUTION. build beast modes for the plan and actuals

    sum( case when `version` = 'Plan' then `Amount` END
    
    sum( case when `version` = 'Actuals' then `Amount` END
    

    Now you have two separate metrics which you could use in a bullet chart provided that you DO NOT put version on the X Axis.

    By using this approach you could also build a beast mode that compares sum(...actuals..) vs. sum(...plan..)

    case
    when 
    sum( case when `version` = 'Plan' then `Amount` END ) >= sum( case when `version` = 'Actuals' then `Amount` END then 'Red' else 'Green'
    )
    

    Note, I generally don't recommend wrapping aggregate functions, SUM() in inside a CASE statement. It usually doesn't work as expected, so i would be unsurprised if it didn't work in the conditional formatting context.

    Jae Wilson
    Check out my 🎥 Domo Training YouTube Channel 👨‍💻

    **Say "Thanks" by clicking the ❤️ in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"
  • faisalnjit
    faisalnjit Member
    Answer ✓

    Thanks all.

Answers

  • You can do this very easily with the color rules. In the Chart Properties, click on Colors and then create a rule based on y-axis field that if the value is less than 25 then color it read.

    You can read more about color rules here: https://knowledge.domo.com/Visualize/Adding_Cards_to_Domo/KPI_Cards/KPI_Card_Building_Part_2%3A_The_Analyzer/Setting_Color_Rules_for_a_Chart

    **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.
  • Hello Mark, Thanks for the reply. But I think i was looking for something else.. By using color rules like show red if value is below x is simple as you said.. Here I am looking for way to show first bar ( Actuals ) red if it is less than 25 % of second bar ( Plans )

  • jaeW_at_Onyx
    jaeW_at_Onyx Coach
    Answer ✓

    @faisalnjit

    1) i would recommend a different visualization. consider the Bullet Chart which was designed to show target vs. actuals. by having data spread across two axis you force users to compare something in a way that may not be intuitive.


    By stacking Actuals and Plan into the same column of your data you've made it slightly more difficult to use the bullet chart and impossible to compare Actuals vs. Plan without using window function in your current chart type.

    SOLUTION. build beast modes for the plan and actuals

    sum( case when `version` = 'Plan' then `Amount` END
    
    sum( case when `version` = 'Actuals' then `Amount` END
    

    Now you have two separate metrics which you could use in a bullet chart provided that you DO NOT put version on the X Axis.

    By using this approach you could also build a beast mode that compares sum(...actuals..) vs. sum(...plan..)

    case
    when 
    sum( case when `version` = 'Plan' then `Amount` END ) >= sum( case when `version` = 'Actuals' then `Amount` END then 'Red' else 'Green'
    )
    

    Note, I generally don't recommend wrapping aggregate functions, SUM() in inside a CASE statement. It usually doesn't work as expected, so i would be unsurprised if it didn't work in the conditional formatting context.

    Jae Wilson
    Check out my 🎥 Domo Training YouTube Channel 👨‍💻

    **Say "Thanks" by clicking the ❤️ in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"
  • @faisalnjit I came across this KB article that might work for you.

    Read the section called "controlling chart colors using beast mode". You might be able to create a calculation that determines what 25% of your other number is and enter that as a goal and then set a color if it is below the goal.

    **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.
  • faisalnjit
    faisalnjit Member
    Answer ✓

    Thanks all.