我正试图围绕如何在源数据被转动后计算的Tableau中创建计算字段。我的源数据是“长的”,即标准化,看起来像这样:
+---------+---------+-------+
| Company | Measure | Value |
+---------+---------+-------+
| A | Sales | 100 |
+---------+---------+-------+
| A | Exp | -10 |
+---------+---------+-------+
| B | Sales | 200 |
+---------+---------+-------+
| B | Exp | -30 |
+---------+---------+-------+
(实际上每家公司都会有两个以上的记录,但这是简化的)
我想知道的是Net
计算为Sales + (2 * Exp)
的情况。
+---------+---------+-------+-------+
| Company | Sales | Exp | Net |
+---------+---------+-------+-------+
| A | 100 | -10 | 80 |
+---------+---------+-------+-------+
| B | 200 | -30 | 140 |
+---------+---------+-------+-------+
我只需将Company
作为我的行,Measure
作为我的列,然后sum(Value)
即可获得以下内容:
+---------+---------+-------+
| Company | Sales | Exp |
+---------+---------+-------+
| A | 100 | -10 |
+---------+---------+-------+
| B | 200 | -30 |
+---------+---------+-------+
但是如何根据旋转Measure
的结果计算其他列?