Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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?

Tags (2)
1 Solution

Accepted Solutions
Not applicable

Re: Pivot Up while loading data

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

1 Reply
Not applicable

Re: Pivot Up while loading data

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