Forum Discussion

wynseun's avatar
wynseun
Regular Visitor
3 years ago
Solved

Pivot/unpivot without aggregation gives error

I'm trying to figure out how to pivot my data on the Attribute column from long to wide format.

 

TeamAttributeValue
AScore123
AYear1999
BScore156
BYear1999
AScore168
AYear2000
BScore198
BYear2000

 

So it looks like this:

 

TeamScoreYear
A1231999
B1561999
A1682000
B1982000

 

Obviously trying to pivot this way is giving me the "list" error because it's trying to reduce score and year to single value for each team. Is this even doable by using the transform interface alone?

  • Hi,

    to obtain this i have added a new column

    = List.Combine( {List.RemoveFirstN( Source[Value],1),{"null"}}) 

    transposed it and then added to the original table (which has been stransposed)

    Then transpose one more time and you get your result

    The advantage is that is all dynamic

    If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!

1 Reply

  • Hi,

    to obtain this i have added a new column

    = List.Combine( {List.RemoveFirstN( Source[Value],1),{"null"}}) 

    transposed it and then added to the original table (which has been stransposed)

    Then transpose one more time and you get your result

    The advantage is that is all dynamic

    If this post is useful to help you to solve your issue, consider giving the post a thumbs up and accepting it as a solution!