Skip to main content
Question

Pivot table and aggregate based on a field


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?

4 replies

stalknecht
Contributor
Forum|alt.badge.img+19
  • Contributor
  • March 20, 2018

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


Forum|alt.badge.img
  • Author
  • 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+19
  • Contributor
  • March 21, 2018
schatt15 wrote:

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
  • March 21, 2018
stalknecht wrote:
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.

 


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