[RETIRED] Formatting table calculations with value_format (3.22+)


The content of this article has been updated and moved to Looker’s technical documentation here.

Formatting Table Calculations
Table Calculations (3.18 Labs Feature)
Creating a percent of total across rows with table calculations
Creating a column percent of total with table calculations
Looker 3.22 Release Notes
Calculating percent of previous and percent change with table calculations
Formatting Table Calculations
(Brayden) #2

If you are using formatted calculations for your LookML Dashboards, the “Get Dashboard LookML” feature was not maintaining these formats when I was trying to create dashboards today.

To fix the formatting within the LookML dashboard code, I found you can edit the generated code to add a value_format parameter as shown below:

- table_calculation: calculation_name
  expression: (expression_goes_here)
  value_format: '0.00\%'

(lloyd tabb) #3

Thanks Brayden, I’ve filed a bug.

(nate nate) #4

Hi @brayden,

This is fixed and will be deployed in the next version of 3.22.
Thanks for your report!


(Bkoltai) #5

Thanks for this awesome feature!

Is there a way to use the html key to define conditional formatting to change font color? I have a table computation that I want to apply a different color to depending on the value of the computation. Ideally, something like:

- table_calculation: delta
  label: delta
  expression: (expression)
  value_format: '#0.0%'
  html: |
    {% if value > 0 %}
      <font color="darkgreen">{{ rendered_value }}</font>
    {% else %}
      <font color="darkred">{{ rendered_value }}</font>
    {% endif %}



It’s not currently possible to use html formatting with table calculations - but I’ll pass this on to the product team!

(Aln2129) #7

This would be a wonderful feature :smile:

(Phil Jones) #8

This is still happening in version 3.40 (Or has started to happen again in 3.40)

(Nicole Beyer) #9

Hi Phil,

This looks like a regression! Have let engineering know so we should have a fix in soon!

(kenneth.vinson) #10

I retired this article. The content can be found in Looker’s technical documentation here.