Skip to main content

Unpivot Columns

Hello,
I just want to know how to unpivot columns in IDEA. The example below is what I am trying to accomplish.  Thanks for the help!
 

Name           Grant Name          Amount

John                 Grant 123               1,000

John                 Grant ABC             4,000

Jane                 Grant ABC              4,000

Jane                 Grant XYZ              2,000

Jane                 Grant 456                1,000

Alex                 Grant 456                 3,000 

The ideal output would be:

Name              Grant 123          Grant 456          Grant ABC          Grant XYZ

 John                       1,000                    0                  4,000                      0

Jane                              0               1,000                 4,000               2,000

Alex                              0               3,000                     0                        0 

Brian Element Thu, 08/29/2019 - 07:35

You can use a pivot table to do this assuming that you only have one row, one column and one data field.  If you have multple fields you can't save the pivot table to an IDEA table.

I took your data and created an IDEA file.

I then created a pivot table.

In the pivot table I used the name as the row, grant name as the column and amount as the data.

In the icons at the top I selected the last one and clicked on the drop-down arrow and selected Send to IDEA Database, this will only be there if you one have one row for each item.

I then click on the Send to IDEA Database

And it created the following database:

I think this is what you are looking for.

 

nhuha.aof@gmail.com Fri, 08/30/2019 - 07:38

Thank you. However, I made an incorrect example. What I currently have is your result now. 
Name              Grant 123          Grant 456          Grant ABC          Grant XYZ
 
 John                       1,000                    0                  4,000                      0
 
Jane                              0               1,000                 4,000               2,000
 
Alex                              0               3,000                     0                        0 
 
And what I'm looking for is:
 
 
 
Name           Grant Name          Amount
 
John                 Grant 123               1,000
 
John                 Grant ABC             4,000
 
Jane                 Grant ABC              4,000
 
Jane                 Grant XYZ              2,000
 
Jane                 Grant 456                1,000
 
Alex                 Grant 456                 3,000 
 

The website encountered an unexpected error. Try again later.