
With(
{
//this With() step is option, i'm just using it to save your specific example table
col_A: [
{
Name: "Andy",
TeamID: "1000,1500,2000"
},
{
Name: "Tom",
TeamID: "1000,1200"
}
]
},
With(
{
//convert the original collection into a 'grouped' collection, by splitting the TeamID into an array and adding a column with the Row Name and another column for each specific Team ID
col_B_grouped:
AddColumns(
col_A,
group,
With(
//save the top level 'Name' column value as 'rowName' for easy reference
{rowName: Name},
AddColumns(
//convert TeamIDs to array by comma split
Split(
TeamID,
","
),
//add the person's name to the nested table
name,
rowName,
//add the discrete 'TeamID' values as their own column
'Team ID',
Value
)
)
)
},
//create a new collection just containing the new nested table we created above
Ungroup(
col_B_grouped,
group
)
)
)