# Mean Median Mode using SQL and DAX

,

## Introduction

In this article, I'm going to introduce the basics of the Statistical Functions - Mean, Median and Mode and how can these be calculated using SQL and DAX. The mean, median and mode are the three most widely used kinds of "averages" in statistics. I think these are very common and you're likely to encounter one or all of these in any statistical inference while working or performing some kind of data analysis.

Let's get started and understand the concepts within.

In this tutorial, I will consider the following series and calculate all the averages based on this only.

Series = 2, 8, 4 ,6, 2, 2

### Mean

The mean is also known as the average of all the numbers in a given series. It is calculated by adding up all the data points in the series and then dividing those by the total number of data points.

The mathematical formula for mean is denoted as follows:

For example, let us calculate the mean of Series. When we add these values we obtain (2 + 8 + 4 + 6 + 2 + 2) = 24. Since the number of data points is 6 in this case, the mean is calculated as 24/ 6 = 4.

Thus, the mean of the Series is 4.

### Median

Median is calculated by ordering all the data points from the series in ascending order and then picking out the middle data point from it. If there are two middle data points, then the median will be calculated as the mean of those two numbers.

The mathematical formula for calculating the median is as follows:

5 (6)

5 (6)