RETIRED: Table Calculations (3.18 Labs Feature)

This article has been replaced by this Looker Docs page.


A common use case for these calculations within our team are period-over-period calcs using the offset function. Is there a way to format these values yet so that numbers can be displayed as percent values or dollar values? (The rounding piece is nice, but not quite sufficient for this purpose.)

1 Like

We do plan to offer a more robust set of formatting options for table calculations in the future, but at this point you could present data as dollars or percents by using the CONCAT function and the desired symbol. Syntax is discussed here. This is not as full featured as true formatting, but may suffice in the interim. Hope that helps!

Thanks, that’s actually a decent workaround.

Thanks for this great feature! We are already encouraging staff to do more Excel-like functions straight inside of Looker.


We’ve now added formatting via value_format to table calculations in version 3.22! This version will be released over the next couple weeks. Read more about how to use this feature here.

  1. Is there a way to only show the calculated field in a visualization.
  2. Is there a way to add the calculation into a pivot as a row total and not under each pivot option.

The best way to only display a calculated field in a visualization is to hide the other series by clicking their name in the legend. This will not hide them permanently, but it will hide them from view.

There isn’t currently a way to create a table calculation that shows up only at the end of all pivoted values, but I will pass this on to the product team. Table calculations are still in beta, so we are looking for ways to improve them!

I’ve only been using Looker for a few weeks but this is a cool feature. Thank you for your hard work! Bringing up a feature that Tableau has, is there a way to do table calculations like running totals or percent of column/row totals?

Hey Lawrence! Great to hear you’re loving table calcs :smiley_cat:

We have a running_total() function in table calcs that makes calculating running totals pretty quick. We have some more about using that here!

For calculating percent of totals, we have a couple posts for doing them down columns and across rows.

Hi Lindsey,

Does Looker have any integration with R?

I don’t have access to this page that might hold some answers:

Is there any way to get the table calculation to display in the Single Value visualization? Currently, it displays the measure that I have chosen, and I do not see any way to customize what gets displayed as the single value.

Hi @ebrakke -
As of Release 3.26 (which will roll out to customers over the next few weeks), you will be able to hide fields in a table by clicking on the gear next to that field in the data table and selecting “Hide From Visualization.”

If you do that for any field that is not your table calculation, your table calculation will populate the single value visualization.


Will that also be available for row totals? It’s a constant bit of friction when creating Pie charts (or donut multiples) to go in and exclude the totals which otherwise take precisely 50% of the visualization.

@abbywest Perfect, thanks!

@Robert_Ellman - Unfortunately no, right now this will only work for fields from the field picker or table calculations.

I’ll keep my fingers crossed for 3.28 :slight_smile:

Hi @abbywest,

I’m wondering if there is a way to apply table calculations column-wise or row-wise. Currently, my table calculations are applied to the entire results dataset, for example:

${users.count} / sum(${users.count}),

uses all ‘users.count’ cells in the calc, however if I have a pivot table and want to show the percentage relative to each row (in lieu of relative to the entire table) then the table calculation would need to group by one of the pivot dimensions.

I hope that makes sense, let me know if I can clarify anything.

Hi @macrae - for rows, you should be able to use offset and for columns, some combination of pivot_index and/or pivot_offset may suffice.

Here is documentation on offsets and documentation on pivot_index.

I hope those help!

Thanks for the info! Super helpful