Maintaining drill paths for custom HTML fields

We’ve all used the HTML parameter one way or another to format our LookML dimensions and measures, however what gets really annoying is that you lose drilling capabilities!

  measure: count {
    type: count
    drill_fields: [detail*]
    html:
  {% if value > 10000 %}
  <font color=“#42a338 ”>{{ rendered_value }}</font>
  {% elsif value > 5000 %}
  <font color=“#ffb92e ”>{{ rendered_value }}</font>
  {% else %}
  <font color=“#fa4444 ”>{{ rendered_value }}</font>
  {% endif %};;
  }

However there’s an easy solution! the #drillmenu link ! All you need to do add anchors linking to #drillmenu to your custom html!
Update: using {{fieldname._link}} also works and allows you to use the drilldown of another field !

  measure: count {
    type: count
    drill_fields: [detail*]
    html:
    <a href="#drillmenu" target="_self">
  {% if value > 10000 %}
  <font color=“#42a338 ”>{{ rendered_value }}</font>
  {% elsif value > 5000 %}
  <font color=“#ffb92e ”>{{ rendered_value }}</font>
  {% else %}
  <font color=“#fa4444 ”>{{ rendered_value }}</font>
  {% endif %}
    </a>;;
  }

Version with _link

  measure: count {
    type: count
    drill_fields: [detail*]
    html:
    <a href="{{count._link}}" target="_self">
  {% if value > 10000 %}
  <span style="color:#42a338;">{{rendered_value}}</span>
  {% elsif value > 5000 %}
   <span style="color:#ffb92e;">{{rendered_value}}</span>
  {% else %}
  <span style="color:#fa4444;">{{rendered_value}}</span>
  {% endif %}
    </a>;;
  }

5 Likes

This doesn’t works for my case. Can anyone help?

What about it doesn’t work?

Actually it worked, I had issue because of more than one logical statements and had to add the same code for drill on all the statements that made it work. But I wish if there was a better solution than that tho. Thanks for getting back!

1 Like