Skip to main content
Question

Pivot table and aggregate based on a field

  • March 20, 2018
  • 4 replies
  • 116 views

Forum|alt.badge.img

I am pivoting a table based on an ID field so that all diagnosis codes are pivoted and grouped based on the ID. Here is an example of source and final tables I am trying to acheive. What transformers will be appropriate to get this done?

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.

4 replies

stalknecht
Contributor
Forum|alt.badge.img+21
  • Contributor
  • 305 replies
  • March 20, 2018

I think that you can use an AttributePivoter to get the desired result.


Forum|alt.badge.img
  • Author
  • 6 replies
  • March 20, 2018

This is where I am confused with the pivoter: I selected patientID to group rows by but for columns I want to select multiple columns to pivot under a single column named "Diagnosis Codes". I do not see the option to select multiple columns.


stalknecht
Contributor
Forum|alt.badge.img+21
  • Contributor
  • 305 replies
  • March 21, 2018

This is where I am confused with the pivoter: I selected patientID to group rows by but for columns I want to select multiple columns to pivot under a single column named "Diagnosis Codes". I do not see the option to select multiple columns.

Depending on the datasource you can use a sqlCreator to get an union select query or you can use the inlineQuerier to get the desired result.

 

See attached template

 

demo.fmwt

 

 


Forum|alt.badge.img
  • Author
  • 6 replies
  • March 21, 2018
Depending on the datasource you can use a sqlCreator to get an union select query or you can use the inlineQuerier to get the desired result.

 

See attached template

 

demo.fmwt

 

 

@stalknecht, thanks for your comment. That is exactly what I ended up doing. I am using SQLCreator with Unpivot sql query to transpose from columns to rows.