Forum Discussion

vaidyarm's avatar
vaidyarm
Contributor
3 years ago

Pivot Data from rows to columns with many possible values for pivot field

Convert this

accountId region reporttype count
1 APAC L1 Feedback Report 2
1 APAC L2 Feedback Report 2
2 APAC L1 Feedback Report 6
2 APAC L2 Feedback Report 4
3 APAC L1 Feedback Report 17
3 APAC L2 Feedback Report 4
3 EU L3 Feedback Report 3

to below one

accountId Region L1 Feedback Report L2 Feedback Report L3 Feedback Report
1 APAC 2 2 0
2 APAC 6 4 0
3 APAC 17 4 0
3 EU 0 0 3

Note : the report type can have many values so don’t need static way of mapping fields
unique key here is accountid and region