**Published:**20 Oct 2020

**Last Modified Date:**19 Jan 2021

### Environment

- Tableau Desktop

### Answer

The attached CSV file,**WaterFall_SampleData.csv**contains

**only three measures:**

**Net Sales**,

**Cost of Sales**and

**SGA**In the following steps,

**Gross Profit**and

**Operating Income**are calculated in Tableau Desktop to create a warterfall chart with using these measures.

- Open
**WaterFall_SampleData.csv**by Tableau Desktop. - Click
**Analysis**>**Create Calculated Field**. Create a calculated field names as**Gross Profit**including the following formula .[Net Sales]-[Cost of Sales]

- Create a calculated field named as
**Operating Income**including the following formula.[Net Sales]-[Cost of Sales]-[SGA]

- Create a calculated field named as
**1. Fix Fields**including the following formula.

This calculated field is used to populate the horizontal frame of the waterfall chart.CASE [Segment] WHEN "Consumer" THEN TODAY() WHEN "Cooperate" THEN TODAY()+1 WHEN "Home Office" THEN TODAY()+4 END

- Create a calculated field named as
**2. Order Of Field**including the following formula.

This calculated field is used to decide the order of measures.CASE INDEX() WHEN 1 THEN 'Net Sales' WHEN 2 THEN 'Cost of Sales' WHEN 3 THEN 'Gross Profit' WHEN 4 THEN 'SGA' WHEN 5 THEN 'Operating Income' END

- Create a calculated field named as
**3. Set Gannt Starting Point**including the following formula.CASE INDEX() Case Index() When 1 Then Total(Sum([Net Sales])) When 2 Then Total(Sum([Cost of Sales])) When 3 Then Total(Sum([Cost of Sales])) When 4 Then Total(Sum([Cost of Sales])) When 5 Then Total(Sum([Net Sales])) End

- Create a calculated field named as
**4. Water Fall Width**including the following formula.IF INDEX() = 1 Then -[3. Set Gannt Starting Point] ELSEIF INDEX() = 2 then -[3. Set Gannt Starting Point] ELSEIF INDEX() = 3 Then TOTAL(SUM([Gross Profit])) ELSEIF INDEX() = 4 Then TOTAL(SUM([SGA])) ELSEIF INDEX() = 5 Then -TOTAL(SUM([Operating Income])) END

- Create a calculated field named as
**5. Labels**including the following formula.IF INDEX() = 1 THEN TOTAL(SUM([Net Sales])) ELSEIF INDEX() = 2 then TOTAL(SUM([Cost of Sales])) ELSEIF INDEX() = 3 Then TOTAL(SUM([Gross Profit])) ELSEIF INDEX() = 4 Then TOTAL(SUM([SGA])) ELSEIF INDEX() = 5 Then TOTAL(SUM([Operating Income])) END

- Place
**1. Fix Fields**with right-clicking and select**1. Fix Fields(Discreate),**then**click OK.** - Right click
**1. Fix Fields**in columns, then select**Show Missing Values.** - Place
**2. Order Of Field**to columns. - Right click
**2. Order Of Field**in columns, then right click the field >**Compute Using**>**1. Fix Fields** - Place
**3. Set Gannt Starting Point**to rows, then then right click the field >**Compute Using**>**1. Fix Fields.** - Change the mark type to
**Gannt Bar.** - Place
**4. Water Fall Width**to size, then then right click the field >**Compute Using**>**1. Fix Fields.** - Place
**5. Labels**to label, then then right click the field >**Compute Using**>**1. Fix Fields.** - Right click
**1. Fix Fields**in columns, then uncheck**Show Header.**

Thank you for providing your feedback on the effectiveness of the article.

Open new Case

Continue Searching

Knowledge Base

Community

Product Help

Training and Tutorials