Looker Studio Function: Median Function

Category: Aggregation function

In data analysis, understanding the central tendency of your dataset is crucial. Looker Studio’s MEDIAN function offers a robust way to determine the middle value of a dataset, providing a more accurate reflection of typical values, especially when outliers are present

Purpose of the Median Function

1. Data Distribution Analysis : The MEDIAN function helps identify the central point of a dataset, offering insights into data distribution.Unlike the mean, the median is less affected by extreme values, making it a reliable measure of central tendency.

2. Customer Segmentation : By analyzing the median of customer metrics such as purchase amounts or session durations, businesses can segment customers into meaningful groups. This segmentation aids in targeted marketing and personalized experiences.

3. Decision Making : Utilizing the median allows decision-makers to base strategies on typical values rather than skewed averages, leading to more informed and balanced decisions.

Type of Calculation:

The MEDIAN function calculates the middle value in a sorted dataset. For an odd number of values, it returns the exact middle value. For an even number, it interpolates between the two central values.

Practical Use Cases:

1. Performance Benchmark :In performance analysis, the median provides a benchmark that reflects the typical performance level, minimizing the impact of outliers.

2. Customer Segmentation : Segmenting customers based on median metrics like purchase frequency helps in tailoring marketing strategies to different customer groups.

3. Time Series Analysis :For time series data, the median can highlight central trends over time, offering insights into seasonal patterns and anomalies.


Median(Metric)

ParameterTypeDescription
XNumericA numeric field or expression

How Does the Median Function Work?
The MEDIAN function sorts the dataset and identifies the middle value. For an odd number of entries, it returns the middle value. For an even number, it averages the two central values

What Does It Run?

The MEDIAN function sorts the dataset and identifies the middle value. For an odd number of entries, it returns the middle value. For an even number, it averages the two central values.

When Should We Use It?

Use the MEDIAN function when you need to understand the central tendency of a dataset, particularly when the data includes outliers that could skew the mean.

Example of MEDIAN Function with Result

Data:
100, 200, 300, 400, 500

Formula:
MEDIAN(Sales)

Result:
300

 

 

Basic Usage

Apply MEDIAN(X) where X is your numeric field to obtain the central value of your dataset.


Column Usage

Ensure that the column used with MEDIAN contains numeric values and is not pre-aggregated.

 

Combining Median with Other Functions

You can combine MEDIAN with other functions like IF or CASE to perform conditional median calculations.

Tips and Tricks

    • Use MEDIAN to understand typical values in your data, especially when outliers are present.

    • Combine MEDIAN with COUNT to assess the distribution of data points around the median.

    • Ensure that the data used with MEDIAN is not aggregated, as the function requires raw data.

1. Can I use MEDIAN with aggregated fields?

No, MEDIAN requires raw numeric data and cannot be used with aggregated fields

2. How does MEDIAN handle an even number of data points?

It interpolates between the two central values to find the median.

3. Is MEDIAN available for all data sources?

MEDIAN is supported for most data sources, but results may vary, especially with BigQuery data sources.

4. Can MEDIAN be used in calculated fields?

Yes, MEDIAN can be used in calculated fields to derive insights from your data.

5. What is the difference between MEDIAN and AVG?

MEDIAN finds the middle value, while AVG calculates the arithmetic mean. MEDIAN is less affected by outliers than AVG.