# DWH Wiki

### Site Tools

charting:tableau:functions:variance

# Variance

The Variance is an aggregate function in Tableau Software. Besides variance, Tableau Software makes other aggregate functions available for the user. As an example, Sum, Average, Count, Maximum, Minimum, Standard Deviation, Standard Deviation (Pop.) and Variance (Pop.).

The Variance has a more statistical nature of the aggregate functions. Another statistical aggregate function is the Standard Deviation. The Standard Deviation is the square root to the variance (Standard Deviation = √Variance)

The Variance is a measurement of the spread between numbers in a data set. The Variance is an aggregation to measure the difference between each number in the data set and the average of the data set, squaring the difference, for a positive count, and divide the sum by squaring the number of values in the set. The Variance is used for probability distribution. As an example, if the variance value is zero, then you have in all data the same value, because there is no difference between the single data.

## Example with Tableau

I will show you an example from Tableau. The example data is the “automotive.tde” from the Business Intelligence session of Mr. Olschimke, you can download the data from Moodle. After downloading the file you open Tableau. If you have started Tableau you click on “File” and open the downloaded file, “automotive.tde”. After loading the files in Tableau, you have to pull the orders_date_purchased dimension on the Columns line. Now you will see the years 2010 to 2015, to make this example a bit more understandable, click on the right arrow of the pill in the columns line and select “Month”, in the lower part. Now you will see the Month from April 2010 to April 2015, if you only see the twelve Months, then you have the wrong Month clicked and you have to click on the other field.

In the next step you will pull the dimension orders_final_price on the Rows line in Tableau. Now you should have the aggregate function SUM of the dimension, if not please choose it. And you choose the sum of the orders per month. To see the variance of them, you have to pull the same dimension again in the Rows Line of Tableau. You see two Lines, normally both of these lines are the same, because the aggregate function SUM is normally the default setting. But we want another aggregate function use of the second dimension in the Rows line. Click again on the arrow from the second pill and under the point “Measure” click the point “Variance”. Now the graph below must be changed his line. The new line represent the Variance of the prices. When you look to the line you will see that some Months do not have a line. The reason is that you have just one Order in a Month and you cannot aggregate with only one order, you need a minimum of two to using the Variance.

In every quarter you have more than one order. If you change the granularity from month to quarter, you will see a continuous line without any breaks.

## Sources 