Conditional / Dynamic Value Format value_format

Knowledge Drop

Last tested: Jan 21, 2019
 

We can't do dynamic formatting using the value_format parameter, but we can using the html parameter! Here is an example that looks at a separate "currency" dimension and puts the proper symbol in front of our measure amount.

 

html:

{% if currency._value == 'EUR' %}

€{{rendered_value}}

{% elsif currency._value == 'USD' %}

${{rendered_value}}

{% else %}

{{rendered_value}}

{% endif %}

;;

This content is subject to limited support.                

Comments
Ben_Zitney
Participant III

This is great but the issue we’re running into is the currency symbol doesn’t show on axis value labels or series value labels.

Philipp_Hagmann
Explorer

This might seem cosmetic, but Looker Team, please don’t underestimate the effects small things like this have for Enterprise customers.

I think it’s pretty bad judgement on the business side to not prioritise this issue.

Version history
Last update:
‎04-05-2021 09:02 AM
Updated by: