知識庫

How to Add Average Lines for Each Dimension Set to Color


發佈時間 : 22 Dec 2022
上次修改日期 : 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
這篇文章是否解決了問題?