Aggregating from multiple columns in Tableau

孤者浪人 提交于 2019-12-23 11:55:28

问题


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:


You can use Tableau’s inbuilt pivot method as below, without reshaping in source .

  1. CTRL Select all 3 dimensions you want to merge , and click on pivot .

  1. You will get your new reshaped data as below, delete other columns :

  1. Finally build your view.

I hope this answers . 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.



来源:https://stackoverflow.com/questions/34427353/aggregating-from-multiple-columns-in-tableau

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!