Explore Courses Blog Tutorials Interview Questions
0 votes
in BI by (17.6k points)

I have a table that looks like: 

id     aff1    aff2    aff3    value

1       a        x      b        5

2       b        c      x        4

3       a        b      g        1

I would like to aggregate the aff columns to calculate the sum of "value" for each aff. For example, the above gives: 

aff    sum

a       6

b       10

c       4

g       1

x       9

Ideally, I'd like to do this directly in tableau without remaking the table by unfolding it along all the aff columns. 

1 Answer

0 votes
by (47.2k points)

Tableau’s inbuilt pivot method can be as below, without reshaping in the source .

  • Click on CTRL and  Select all 3 dimensions you want to merge, and click on 'pivot'.

enter image description here

  • As are result, you will get your new reshaped data as below, delete other columns :

enter image description here

  • Finally, build your view.

enter image description here

  • I hope this answers everything. Rest other options for the above results include JOIN at DB level or creating multiple calculated fields for each attribute value which are not scalable.

Related questions

Browse Categories