Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pivot Up while loading data

Hi

I have my data source table in this format:

Customer IDCategory TypeCategory Value
1AA1
2AA2
3AA3
4AA4
1BB1
2BB1
3BB2
4BB3
1CC1
2CC2
3CC3
4CC4
5CC1

and while loading the data in QV I want to load it in the following format:

Customer IDABC
1A1B1C1
2A2B1C2
3A3B2C3
4A4B3C4
5--C1

Any ideas?

1 Solution

Accepted Solutions
Not applicable
Author

T1:

LOAD * INLINE [

CustomerID, CategoryType, CategoryValue

1, A, A1

2, A, A2

3, A, A3

4, A, A4

1, B, B1

2, B, B1

3, B, B2

4, B, B3

1, C, C1

2, C, C2

3, C, C3

4, C, C4

5, C, C1

];

  

T2:

LOAD

          CustomerID,

          MaxString(If(CategoryType = 'A', CategoryValue)) AS A,

          MaxString(If(CategoryType = 'B', CategoryValue)) AS B,

          MaxString(If(CategoryType = 'C', CategoryValue)) AS C

Resident T1

Group By CustomerID;

DROP Table T1;

JG

View solution in original post

1 Reply
Not applicable
Author

T1:

LOAD * INLINE [

CustomerID, CategoryType, CategoryValue

1, A, A1

2, A, A2

3, A, A3

4, A, A4

1, B, B1

2, B, B1

3, B, B2

4, B, B3

1, C, C1

2, C, C2

3, C, C3

4, C, C4

5, C, C1

];

  

T2:

LOAD

          CustomerID,

          MaxString(If(CategoryType = 'A', CategoryValue)) AS A,

          MaxString(If(CategoryType = 'B', CategoryValue)) AS B,

          MaxString(If(CategoryType = 'C', CategoryValue)) AS C

Resident T1

Group By CustomerID;

DROP Table T1;

JG