我的示例数据如下所示。但是原始数据非常大,所以我不能硬编码。
+-----+-------+---------+
| IDN | NAME | VALUE |
+-----+-------+---------+
| 121 | test | 1254.25 |
| 152 | testa | 1585.25 |
| 587 | testb | 5878.69 |
+-----+-------+---------+
转置功能后: -
+---------+---------+---------+
| 121 | 152 | 587 |
+---------+---------+---------+
| test | testa | testb |
| 1254.25 | 1585.25 | 5878.69 |
+---------+---------+---------+
预期: -
+-------+---------+---------+---------+
| IDN | 121 | 152 | 587 |
+-------+---------+---------+---------+
| NAME | test | testa | testb |
| VALUE | 1254.25 | 1585.25 | 5878.69 |
+-------+---------+---------+---------+
我使用t()函数是spotfire但是在结果数据表中我错过了作为rownames的列名。无论如何都要保持
答案 0 :(得分:0)
您可以使用UnPivot和Pivot执行此操作。
这是数据表设置
Add the transformations:
a. Unpivot
Add columns to pass through:
IDN
Add columns to transform:
NAME
VALUE
Category column name: Column
Select category column data type: String
Value column name: Value
Select value column data type: String
Select 'Include null values'
b. Pivot
Choose row identifiers:
Column
Choose value columns and aggregation methods:
Concatenate(Value)
Choose column titles:
IDN
Column naming pattern: %M(%V) for %C