lil chill
lil chill

Reputation: 75

How to add values within a particular column in tableau

|NAME|ITEM |VALUE|
|john| pen | 4 |
|john| book | 7 |
|john| cup | 3 |
|Eric| pen | 9 |
|Eric| book | 8 |
|Eric| cup | 1 |

I want to create a field or column called "office" which equals the sum of the values of pen & book , that is, office = "pen + book"

Upvotes: 1

Views: 391

Answers (2)

AnilGoyal
AnilGoyal

Reputation: 26238

I created sample data like you have given. Now proceed this way

enter image description here

create a calculated field office with the following calculation

SUM(
IF [item] = "pen" OR [item] = "book" then [value] ELSE 0 END
)

Add this field to viz and your desired output is ready

enter image description here

Upvotes: 2

Fabio Fantoni
Fabio Fantoni

Reputation: 3167

What you're looking for should be the Group functionality:

https://help.tableau.com/current/pro/desktop/en-us/sortgroup_groups_creating.htm

Upvotes: 0

Related Questions