In this article, we will show you how to add Reference Distributions in Tableau with examples.
For this Tableau Reference distribution, we will Connect to SQL and write the Custom SQL Query against the SQL Data Source.
SELECT ProdSubCat.EnglishProductSubcategoryName, Tery.[SalesTerritoryCountry],
Prod.EnglishProductName, Prod.Color, Fact.OrderQuantity, Fact.TotalProductCost,
Fact.SalesAmount, Fact.TaxAmt, Fact.[Freight],Fact.OrderDate
FROM DimProductSubcategory AS ProdSubCat
INNER JOIN
DimProduct AS Prod ON ProdSubCat.ProductSubcategoryKey = Prod.ProductSubcategoryKey
INNER JOIN FactInternetSales AS Fact ON Prod.ProductKey = Fact.ProductKey
INNER JOIN [DimSalesTerritory] AS Tery ON Tery.[SalesTerritoryKey] = Fact.[SalesTerritoryKey]
Add Reference Distributions in Tableau
In this example, We are going to add Reference Distributions to the Bar Chart. To do this, first, Drag and Drop the Color, English Product Name from the Dimension Region to the Columns Shelf, and Sales Amount from the Measures Region to the Rows Shelf, as shown below. By default, it will generate the Bar Chart for you.
To add Reference Distributions in Tableau, Right-click on the Sales Amount Axis, which will open the context menu. Please select the Add Reference Line option from it.
Once you select the Add Reference Line option, a new window called Add Reference Line, Band, or Box will open to configure the reference Distributions. This article is about adding Reference Distributions. Please select the Distributions Tab, as shown below.
TIP: Please refer to Add Reference Lines to add the Reference Lines and Add Reference Bands article to understand the configuration of Reference Bands.
- Box Plot
- Forecasting
- Trend Lines
- Add Reference Lines using the Parameter
- Show or Hide Reference Lines using the Parameter
From the below screenshot, you can observe that we have three options for the Scope region:
- Entire Table: If you select this option, it will compute aggregation for the whole table and add Reference distributions for the entire table
- Per Pane: If you choose this option, Tableau will compute aggregation for individual panes inside the table and add Reference Distributions to the individual pane
- Per Cell: Selecting this option will compute aggregation for an individual cell inside the table and add Reference Distributions to the individual cell.
Add Reference Distribution to the Entire Table
To add Reference Distributions to the Entire table in Tableau, select the Entire Table option in the Scope region. From the below screenshot, you can observe the available options inside the Entire Table Reference Lines option.
Within the Line region, the Value option will decide the Data used by the reference Distributions. Please select the Measure value we will use for creating reference Distributions (Here, we are choosing the Sales Amount).
The following are the aggregations available in the Percent of options inside the Value field:
- Total: This option will place lines at the aggregate of all the values of a selected Measure (here it is, Sales Amount)
- Sum: It puts lines at the Sum of the selected Measure (here it is, Sales Amount)
- Constant: This option places lines at the Specified Constant value
- Minimum: This option will place lines at the Minimum of the selected Measure (here it is, Sales Amount)
- Maximum: This option will set lines at the Maximum of the selected Measure (here it is, Sales Amount)
- Average: This option places the lines at the Average of the selected Measure (here it is, Sales Amount)
- Median: It will put lines at the Median of the selected Measure (here it is, Sales Amount)
The label allows you to configure whether you want to see the Label or not. This option has different fields:
- None: If you select this option, Tableau will not display any label for the Reference Distribution
- Value: This option displays the aggregated value of a measure chosen as a label for the Reference Distribution
- Computation: If you select this option, Tableau displays the aggregate Function Name or Measure name as a label for the Reference Distribution
- Custom: Selecting this option displays the Custom value you specified in the text box as a label for the Reference Distribution
In this example, we are selecting the Value as a label. The formatting region allows us to format the Tableau Reference Distribution Type, Color, Width, and Background color of the Distribution region. The below screenshot will show how we can format the reference Distribution.
From the screenshot below, you can observe that We added a Light Yellow color to fill the space between the Values or Distribution regions.
Within the Formatting area, we have the following options:
- Fill Above: If you checkmark this option, it will add the selected color to the region above the Distribution
- Fill Below: If you checkmark this option, it adds the selected color to the area below the Distribution
- Symmetric: This option adds similar colors to the region above and below the Distribution
- Reverse: This will reverse the Fill Above color and Fill Below the color
When we checkmark any of the above options, we must change the Fill property from single color to built-in Pallets, as shown below.
From the below screenshot, you can observe that When we checked the Reverse option, the Fill Above Color and Fill Below colors interchanged.
Click OK to finish adding reference Distributions to the bullet Graph. The below screenshot will show you the Reference Distribution for the Entire Table.
Editing Reference Distribution in Tableau
To Edit the existing Tableau Reference Distributions, right-click the Sales Amount Axis, which will open the context menu. Please select the Edit Reference Line option, as shown below.
Let us change the Computation value from Percentages to Percentiles, and Please select the Percentiles from the available ones or enter the Custom value. It also allows you to use the existing Parameters or New parameters. For now, we are selecting 80, as shown below.
Let us change the Computation value from Percentiles to Quantiles, and Please select the Quantiles from the available ones. It also allows you to use the existing Parameters or New parameters. For now, we have chosen four, as shown below.
This time, we changed the Computation value from Quantiles to Standard Deviation. Please write down the Factors for the Standard Deviation. By default, It displays factors as (-1, 1), and we are happy with the same. However, you can change it as per your project requirements.
Click OK to finish adding the reference Distribution of Computation Value as Standard Deviation of Factors (-1, 1). The screenshot below will show you the Tableau Reference Distributions for the Entire table
Removing Reference Distributions in Tableau
To remove Reference Distributions in Tableau, Right-click on the Sales Amount Axis, which will open the context menu. We may have multiple options to remove reference Distributions. For instance,
- If your report holds only one Reference Line, then you can select the Remove Reference Line option.
- If your report holds more than one Reference Line, select the Remove Reference Line option, and then select the required reference line.
- And If you want to remove multiple Reference Lines at one go, select the Remove All Reference Lines option.
Adding Reference Distributions Per Pane
To add Reference Distributions Per Pane in Tableau, select the Per Pane option in the Scope region. From the below screenshot, you can observe we changed the Computation Value of the Computation region from 60%, 80% of Average to 30%, 60%, 80% of Average, and we changed the Fill Pallet to Blue and yellow within the Formatting region.
Click OK to finish adding reference Distributions Per Pane to the bullet Graph. The screenshot below shows you the Tableau Reference Distributions for the Individual Pane.
From above, notice that it is finding the minimum value for individual panes and calculating the Average for individual panes rather than the entire table.
Adding Reference Distributions Per Cell
To add Reference Distributions Per Cell in Tableau, select the Per cell option in the Scope region. From the below screenshot, we changed the Computation Value of the Computation region from 30%, 60%, 80% of Average to 60%, 90% of Average. Next, we changed the Fill Pallet to light Yellow, Unchecked Fill Above, and Fill below options within the Formatting region.
Click OK to finish adding Tableau reference Distributions Per Cell. The below screenshot will show you the Reference Distributions for the Individual Pane.