Skip to main content
Question

Transpose (rotate) data from rows to columns

  • April 23, 2018
  • 3 replies
  • 120 views

Forum|alt.badge.img

I'm reading a source file and this is the output.

What I would like to have instead is only one row per Name and then have one column for each number of months (as attribute name) and its RRP (as attribute value).

The columns should be the following:

header/attributes:

Name ; 3-Months-RRP ; 6-Months-RRP ; 9-Months-RRP ; 12-Months-RRP

values:

AR201130 ; 5.82; 11.64 ; 17.46 ; 19.40

Thanks for your help.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • April 23, 2018

I believe the AttributePivoter transformer should be able to do this.


danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • April 23, 2018

Hi @kat

Did you try to use the custom transformer AttributeTransposer?

Thanks,

Danilo


takashi
Celebrity
  • 7843 replies
  • April 23, 2018

Hi @kat, I often use a combination of BulkAttributeRenamer and Aggregator for this kind of task. The AttributeCreator can alto be used to create a new attribute named "@Value(NumberOfMonths)-Months-RRP" storing the value of "RRP", instead of the BulkAttributeRenamer.