Can I make the `value_format` syntax change conditionally?

Knowledge Drop

Last tested: Apr 15, 2018
 

Yes, you can use the following syntax to conditionally format using value_format. This can be done in LookML OR it can be done in the EDIT menu in the Visualization. Note there are extra \ characters in the LookML version to help escape use of " characters.

Warning: value_format only takes three different conditions for evaluation. If you add a fourth it will not evaluate properly.

LookML Use

measure: count {

type: count

value_format: "[<1000]0;[>=1000000]0.00,,\"M\";[>=1000]0.0,\"K\""

}

EDIT UI Menu Use

Value Format (UI field):

[<1000]0;[>=1000000]0.00,,"M";[>=1000]0.0,"K"

For more tips on common value_formats, you can refer to this Docs page here.

This content is subject to limited support.                

Version history
Last update:
‎06-14-2021 05:55 PM
Updated by: