KNOWLEDGE BASE

## Create Z Chart (Numbers, Accumulated Total Numbers, Movement Total Numbers) Within a Year in a View

Published: 18 Aug 2020
Last Modified Date: 19 Aug 2020

### Question

How to make Z Chart with numbers line, accumulated total numbers line, movement total line within a year in a view like below.

### Environment

• Tableau Desktop

### Answer

1. Drag Continuous Month to [Columns], and drag [Sales] to [Rows]
2. Create a Parameter named [!Start Date] to control the start date of the graph
3. Create a Calculated field named [!One Year Range of Date] to filter a year range. And drag it into [Filters] Shelf
• DATEDIFF('month',[!Start Date], LOOKUP(MIN([Order Date]),0))<=11
AND  DATEDIFF('month',[!Start Date], LOOKUP(MIN([Order Date]),0))>=0
4. Create a Calculated field named [!Movement Total] to show the movement of total sales. And add it to the view.
• WINDOW_SUM(SUM([Sales]), -11,0)
5. Create a Calculated field named [!Accumulated Total Numbers] to show the accumulated sales within a year.
• IF DATEDIFF("month",[!Start Date], [Order Date])>=0 THEN [Sales] END
6. Add [!Accumulated Total Numbers] into the view and set the table calculation as [Running Total]
Did this article resolve the issue?