Skip to main content
Solved

Pivot rows to columns


nedwaterman
Contributor
Forum|alt.badge.img+9

Why isn't this easier in FME? I've tried lots of examples on the Hub, but can't get any of them to work. The Attribute Pivoter is difficult to use and never gives me the results I need. I can perform this very easily in SQL.

 

I'm trying to turn my rows Vxx into columns with the value of Litres, grouped by all the other rows. Any idea how I can achieve this? Thanks in advance!

 

Best answer by ebygomm

@nedwaterman Example workspace attached - it's in 2019.2 - it'll warn about the workspace not being compatible but should open correctly

pivot.fmwt

View original
Did this help you find an answer to your question?

9 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 19, 2020

Can you give an example of what the output should look like?


nedwaterman
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • March 19, 2020

Certainly - find it attached!example.xlsx


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 19, 2020

I nearly always use pivot data by using the value of an attribute to create a new attribute with that name, then aggregate and merge attributes and expose the newly created attributes

You can import the values from the period column in the original input in the AttributeExposer

Gives this output


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 19, 2020

You can use the attribute pivoter though as well, you still need to expose the attributes if you want to see them on the canvas

The attribute pivoter does set up a schema for you which makes it slightly more straightforward to write th data out dynamically without exposing the attributes


nedwaterman
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • March 19, 2020
ebygomm wrote:

I nearly always use pivot data by using the value of an attribute to create a new attribute with that name, then aggregate and merge attributes and expose the newly created attributes

You can import the values from the period column in the original input in the AttributeExposer

Gives this output

That would be perfect. Would you mind sending me your workflow? I'm on 2019.1.

 

Thank you very much for taking the time to help me with this - it's been driving me mad!


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • March 19, 2020

@nedwaterman Example workspace attached - it's in 2019.2 - it'll warn about the workspace not being compatible but should open correctly

pivot.fmwt


nedwaterman
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • March 19, 2020
ebygomm wrote:

You can use the attribute pivoter though as well, you still need to expose the attributes if you want to see them on the canvas

The attribute pivoter does set up a schema for you which makes it slightly more straightforward to write th data out dynamically without exposing the attributes

Thanks very much ebgygomm - I've used this approach and it works beautifully. You've saved me from insanity!


nedwaterman
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • March 19, 2020
ebygomm wrote:

@nedwaterman Example workspace attached - it's in 2019.2 - it'll warn about the workspace not being compatible but should open correctly

pivot.fmwt

Thank you - you have been a great help!


smclaugh1
Contributor
Forum|alt.badge.img+5
  • Contributor
  • September 29, 2022

@ebygomm​ 

Thanks for the great pivot examples, these are perfect.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings