Reverse Running Totals

  • 23 June 2022
  • 1 reply

Userlevel 5

Looker will not be updating this content, nor guarantees that everything is up-to-date. 

Starting in Looker 21.12, you can use Quick Calculations to perform common calculations on numeric fields that are in an Explore's data table without using Looker functions and operators when the Custom Fields Labs feature is enabled, and you have permission to use them.

You can create running totals very easily with a table calculation that will sum the numbers going down the columns. If you switch the sorting, you will still get running totals going downward.

What if you want to sort your data newest to oldest and have the running total calculated bottom to top? You can also do this with table calculations.

Suppose I had a measure called "Flights Count" and wanted to sort by years in descending order, like the following table:

The reverse running total is created with two table calculations:

  • The first is just a normal running total:


  • The second gets the sum of "Flights Count" for the first row, then each subsequent row subtracts the running total from the sum:


1 reply

Really helpful information, thank you!