Question

Change Header Background fill/color selectively?


Userlevel 2

Hi,

 

I have a pivot tables with different levels of dimensions. I was wondering if there is a way we can selectively change columns’ backgrounds. For example, we would like to change the header called “Cumul. Rtn” to light green. Is this possible at all?

 


This topic has been closed for comments

2 replies

Userlevel 1

Hi Hwi, 

 

I’m thinking we could use the the html parameter in your lookml dimension in order to change the background color based on your values (as mentioned in this help article). For example, if I have a field called Status I can conditionally change the background color of its values : 

 dimension: status{

    description: "this is my description"

    type:string

    sql:${TABLE}.status;;

      html:{% if value == 'cancelled' %}

      <p style="color: black; background-color: lightblue; font-size:100%; text-align:center">{{ rendered_value }}</p>

    {% elsif value == 'pending' %}

      <p style="color: black; background-color: lightgreen; font-size:100%; text-align:center">{{ rendered_value }}</p>

    {% else %}

      <p style="color: black; background-color: orange; font-size:100%; text-align:center">{{ rendered_value }}</p>

    {% endif %}

    ;;

  }

 

Userlevel 2

This is the best I could do. Is there a way we can get rid of the margin in between the headers?