Red/Green Conditional Arrows

j_witty
Participant I

Hello Looker Community, 

I am building out a single value visual that is meant to to show the percent change of a value from the previous week.  So the single viz shows either a positive or negative percentage.  I added in some up/down triangles to to help signify the change.  I would like to change the formatting of only these triangles to be red or green depending on the change, while keeping the value and text black.  Using conditional formatting on the whole visual was not great because for some reason the title becomes very transparent and difficult to read.  Open to any suggestions.  One attempt that got me close was to use unicode characters in the custom value format, alas only red up/down triangles exists, I was unable to find any green triangle unicode characters to complete this method.

2 3 1,723
3 REPLIES 3

Same issue here. Anyone could help?

 @j_witty @AndersonOliveir There may be other ways to do it, Below method gives you more control on the formatting.   Below measure displays the Sales info and in the next line it will conditionally display green up arrow or red down arrow based on yoy_change and also display the YoY Percent Change and YoY Change in Dollor format.

Hope below measure definition gives you the inspiration.

 

 

measure: sales_sum_dash_w_formatting {
    hidden: yes
    label: "Sales(For Dashboard Only)"
    type: number
    sql: ${sales_sum_dash} ;;
    value_format_name: gbp_0
    html:
     @{dynamic_pound_value_format_liquid}<br>
    {% if sales_yoy_chg_dash._value    >= 0 %}
      <span style="color: green;">▲ {{sales_yoy_percent_chg_dash._rendered_value }} </span>
    {% else %}
      <span style="color: red;">▼ {{sales_yoy_percent_chg_dash._rendered_value }} </span>
    {% endif %}
    <span style="color: #b2b2b2;">

      {% if  sales_sum_last_year_dash._value    >=1000000000 %}
        (vs. ${{ sales_sum_last_year_dash | divided_by: 1000000000 | round: 2 | times: 1 }}B)

      {% elsif sales_sum_last_year_dash._value >=1000000 %}
        (vs. ${{ sales_sum_last_year_dash | divided_by: 1000000 | round: 2 | times: 1 }}M)

      {% elsif sales_sum_last_year_dash._value >=1000 %}
        (vs. ${{ sales_sum_last_year_dash | divided_by: 1000 | round: 2 | times: 1 }}K)

         {% elsif sales_sum_last_year_dash._value >= 0  %}
       (vs. ${{ sales_sum_last_year_dash | divided_by: 1 | round: 0 | times: 1 }})


      {% endif %}
      </span>
      ;;
}

 

 

Regards,
Prabha Arivalagan

@prabhakaran_mai thanks for your prompt response. Sorry as I forgot to mention that I don't have developer access on my organization. I'm only able to create explores, looks and dashboards. Is there anyway of doing Red/Green Conditional Arrows using any sort of custom fields?

Top Labels in this Space
Top Solution Authors