# 12.18. Running Calculations

In this lesson, we'll dive into running calculations in Looker Studio. These calculations can be applied to tables and time series to provide useful insights into your data.

**Learning objectives**

- Understand the difference between comparison and running calculations in Looker Studio.
- Learn how to apply running calculations to tables and time series.
- Explore various types of running calculations and their use cases.
- Discover the impact of sorting data on running calculations.

## Comparison & Running Calculations

In Looker Studio, there are two types of calculations: **comparison** **calculations** and **running calculations.**

**Main concepts and topics**

In this lesson, you will learn about comparison and running calculations in Looker Studio.

**Comparison calculations** compare a value with the total, maximum, or minimum, while running calculations perform cumulative calculations, such as adding values together over time.

**Running calculations** can be applied to tables and time series to provide deeper insights into data trends. However, running calculations are only shown and cannot be used in further calculations. Sorting data can also impact the way running calculations are displayed.

### Comparison Calculations

Comparison calculations compare the value with the total, maximum, or minimum of the same dataset.

For example, you can apply a percentage of the total calculation to see what percentage a certain value represents of the total. This can be helpful in understanding how different values relate to the whole dataset.

**Running Calculations in Looker Studio**

**Running Calculations in Looker Studio**

Running calculations, on the other hand, allow you to perform cumulative calculations, such as adding values together over time. For example, you can calculate the running total of new users by date. This can be useful in identifying trends and understanding how metrics change over time.

**Running Sum Calculations in Looker Studio**

**Running Sum Calculations in Looker Studio**

This calculation adds up the values cumulatively, providing a running total.

A **running sum** is a mathematical operation that calculates the cumulative total of a set of numbers as they are being processed. In the context of data analysis, this can be a powerful tool to analyze trends and patterns over time or across categories.

For example, a sales team may use a running sum to track their cumulative sales revenue throughout the month, or an eCommerce site may apply a running sum to monitor the total number of items sold across various product categories.

**Running Sum Example with Tables**

Let's consider a simple table representing the daily sales revenue for a retail store:

Date | Sales Revenue |

2023-05-01 | 1000 |

2023-05-02 | 1200 |

2023-05-03 | 1500 |

2023-05-04 | 900 |

2023-05-05 | 1800 |

Suppose you want to calculate the running sum of daily sales revenue to track the cumulative sales over time. After applying the calculation, your table will look like this:

Date | Sales Revenue | Cumulative Sales Revenue (Running Sum) |

2023-05-01 | 1000 | 1000 |

2023-05-02 | 1200 | 2200 |

2023-05-03 | 1500 | 3700 |

2023-05-04 | 900 | 4600 |

2023-05-05 | 1800 | 6400 |

The running sum of daily sales revenue is calculated by adding the sales revenue for each day, with the sum growing as new days are included.

### Running Min and Max Calculations in Looker Studio

These calculations display the minimum, maximum, or count of values as you go through the data.

**Running min** and **running max** calculations are similar to running sums, but instead of computing a cumulative total, they determine the minimum or maximum value in a sequence up to a given point. These calculations can be invaluable for identifying peaks and troughs or for tracking the highest and lowest values in a dataset.

**Running Min and Max Example with Tables**

Let's illustrate running min and max calculations using a simple table representing daily sales data:

Date | Sales |

2023-05-01 | 100 |

2023-05-02 | 250 |

2023-05-03 | 150 |

2023-05-04 | 300 |

2023-05-05 | 200 |

After applying running min and max calculations, your table will look like this:

Date | Sales | Running Min Sales | Running Max Sales |

2023-05-01 | 100 | 100 | 100 |

2023-05-02 | 250 | 100 | 250 |

2023-05-03 | 150 | 100 | 250 |

2023-05-04 | 300 | 100 | 300 |

2023-05-05 | 200 | 100 | 300 |

As you can see, the running min and max values update as new rows are added to the dataset, reflecting the lowest and highest sales values encountered up to each date.

Running min and max calculations in Looker Studio can help you uncover trends and gain a deeper understanding of your data, making it easier to identify areas of success or improvement.

### Running Average Calculations in Looker Studio

**The Concept of Running Average**

A **running average**, also known as a cumulative average, is a calculation that determines the average value of a sequence up to a given point. This can be particularly useful for smoothing out fluctuations in data and identifying trends over time.

**Running Average Example with Tables**

Let's consider a simple table representing the daily number of website visitors:

Date | Visitors |

2023-05-01 | 100 |

2023-05-02 | 150 |

2023-05-03 | 200 |

2023-05-04 | 250 |

2023-05-05 | 300 |

Suppose you want to calculate the running average of daily visitors. After applying a **running average** and a **running sum** calculation, your table will look like this:

Date | Visitors | Cumulative Visitors | Running Average of Visitors |

2023-05-01 | 100 | 100 | 100 |

2023-05-02 | 150 | 250 | 125 |

2023-05-03 | 200 | 450 | 150 |

2023-05-04 | 250 | 700 | 175 |

2023-05-05 | 300 | 1000 | 200 |

The running average of daily visitors is calculated by dividing the cumulative number of visitors by the number of values, providing a clearer view of the overall trend in website traffic.

### Running Delta Calculations in Looker Studio

**Running Delta:** This calculation displays the difference between the current value and the one before it.

**The Concept of Running Delta**

A **running delta** is a calculation that computes the difference between consecutive values in a dataset. This can help you analyze how values change from one period to another and detect trends or anomalies in your data.

**Running Delta Example with Tables**

Let's consider a simple table representing the daily number of orders for an online store:

Date | Orders |

2023-05-01 | 50 |

2023-05-02 | 75 |

2023-05-03 | 90 |

2023-05-04 | 80 |

2023-05-05 | 120 |

Suppose you want to calculate the running delta of daily orders to analyze how the number of orders changes from day to day. After applying a running delta calculation, your table will look like this:

Date | Orders | Previous Day Orders | Running Delta of Orders |

2023-05-01 | 50 | - | - |

2023-05-02 | 75 | 50 | 25 |

2023-05-03 | 90 | 75 | 15 |

2023-05-04 | 80 | 90 | -10 |

2023-05-05 | 120 | 80 | 40 |

The running delta of daily orders is calculated by subtracting the previous day's orders from the current day's orders, revealing the day-to-day fluctuations in order volume.

**Note**: The running calculations are only shown and cannot be used in further calculations. The actual value remains unchanged.

## Sorting Data

Sorting your data can impact the way running calculations are displayed. For example, sorting data in ascending order will show running calculations differently than when sorted in descending order. Keep this in mind when analyzing your data.

In this lesson, you've learned about running calculations in Looker Studio and how they can be applied to tables and time series to provide deeper insights into your data. Remember that running calculations are only for display purposes and cannot be used in further calculations.

**In this chapter:**

→ 12.2. Use Cases for Parameters

→ 12.3. Properties of Parameters

→ 12.4. Parameters: From Creation to Visualization

→ 12.5. Parameters: Range of Values

→ 12.8. Parameter Example: Google Maps Link

→ 12.9. Parameter Example: UTM Generator

→ 12.10. Parameter Example: Dynamic Dimension

→ 12.11. Parameter Example: Dynamic Metric

→ 12.12. Parameter Example: Dynamic Comparison

→ 12.13. Parameter Example: Dynamic Filter Controls

→ 12.14. Parameter Example: Projection & Custom Calculators

→ 12.16. Parameters in Dynamic SQL for BigQuery

📩 Receive my **weekly Looker Studio tips**

🎥 Subscribe to my **YouTube channel**

🖇 Connect with me on **LinkedIn**