How to Add Average Lines for Each Dimension Set to Color

Published: 22 Dec 2022
Last Modified Date: 23 Dec 2022


Is it possible to add trend lines for each dimension member in Color on a scatterplot?


  • Tableau Desktop


Below is an example to add average lines of Profit for each Category in the Sales and Profit scatterplot.

User-added image

1. Add SUM(Sales) to Columns.
2. Add SUM(Profit) to Rows.
3. Add Sub-Category to Detail.
4. Add Category to Color.
5. Create a calculated field and name it Profit for Furniture.
IF [Category]="Furniture" THEN [Profit] END
6. Create a calculated field and name it Profit for Office Supplies.
IF [Category]="Office Supplies" THEN [Profit] END
7. Create a calculated field and name it Profit for Technology.
IF [Category]="Technology" THEN [Profit] END
8. Add SUM(Profit for Furniture), SUM(Profit for Office Supplies), and SUM(Profit for Technology) to Detail.
9. Open Analytics pane and drag Average Line to Table > SUM(Profit).
10. Right-click the average line on the view and select Edit. Configure it as follows:
 User-added image
11. Repeat step 9 & 10 to add more average lines.
 User-added image
 User-added image
Did this article resolve the issue?