Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Lines into columns - Like a PIVOT

Hello everyone.

Can I have a script that turns my records into column names?
Example:

Table
--------
Scenario; Name, LastName, Married
1, John; Kimball; Yes
1, Mary; Kimball; No
2, John; Kimball; No
2, Mary; Kimball; No


Final Table
---------------
Scenario; John_Kimball; Mary_Kimball
1, Yes, No
2, No, No


The solution would be something like the following script, but of course it does not work that way:

LOAD Married AS Name & '_' & LastName RESIDENT Table;

Thanks.

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello,

Try the following:

Original:LOAD * INLINE [Scenario, Name, LastName, Married1, John, Kimball, Yes1, Mary, Kimball, No2, John, Kimball, No2, Mary, Kimball, No]; Step1:LOAD Scenario, Name & '_' & LastName, MarriedRESIDENT Original; DROP TABLE Original; Step2:GENERIC LOAD *RESIDENT Step1; DROP TABLE Step1;


Hope that helps

View solution in original post

1 Reply
Miguel_Angel_Baeyens

Hello,

Try the following:

Original:LOAD * INLINE [Scenario, Name, LastName, Married1, John, Kimball, Yes1, Mary, Kimball, No2, John, Kimball, No2, Mary, Kimball, No]; Step1:LOAD Scenario, Name & '_' & LastName, MarriedRESIDENT Original; DROP TABLE Original; Step2:GENERIC LOAD *RESIDENT Step1; DROP TABLE Step1;


Hope that helps