Transform a table

#1

Hello,
I have a table like
id date role
1 2007 10
1 2019 11
2 2008 20
3 2005 30
3 2007 31
3 2018 32

I want to transform this table so as I can see unique id and append columns as much as the id is repeated
example :
id date1 role1 date2 role2 date3 role3
1 2007 10 2019 11 - -
2 2008 20 - - - -
3 2005 30 2007 31 2018 32

Any help , thank you a lot !

0 Likes

#2

Use


with grouping on id, pivoting on date and list/first/last aggregation on role.

2 Likes

#3

Thanks for your response, but I want also date as data not a pivot !

0 Likes

#4

Hi @Abdessamad7

I created a workflow transform_a_table.knwf (37.4 KB) which I think does the job. Hope this helps.

gr. Hans

2 Likes

#5

Hi there @Abdessamad7,

In order to use only Pivoting node as suggested by @izaychik63 you should add additional column that will be Pivot column:

TableForPivoting

To create this column you can modify solution provided by @HansS in this topic:

Br,
Ivan

1 Like