lbug
lbug

Reputation: 371

Excluding data points from Tableau trend chart

I am trying to make a trend chart that has two lines on it. The first is a sum of a field over time, except for one data point that I want to exclude from the sum of two years, and the other is a summation of a subset of rows.

For example:

+--------+------+--------+
| FRUIT  | YEAR | NUMBER |
+--------+------+--------+
| Apple  | 2012 | 2      |
| Banana | 2012 | 3      |
| Pear   | 2012 | 2      |
| Apple  | 2013 | 3      |
| Banana | 2013 | 3      |
| Pear   | 2013 | 3      |
+--------+------+--------+

I would want one line to be the sum of all three fruit over time, but to exclude pears in 2013, and the second line to be Apples and Bananas over time.

Upvotes: 0

Views: 1646

Answers (1)

Bernardo
Bernardo

Reputation: 3348

These should work.

Line 1:

sum(if [Fruit] = "Pear" and [Year] = 2013 then null else [Number] end)

Line 2:

sum(if [Fruit]!="Pear" then [Number] end)

Upvotes: 2

Related Questions