Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating new column from already existing columns

I have 3 columns as Below

A   B    C

1    2    4

2    1    3

3    5    1

I want to create 2 columns from the above 3 columns like below.

NewColumn   Value

A                     6

B                     8

C                     8

How can I acheive this ?

4 Replies
sunny_talwar

May be like this:

Table:

LOAD * Inline [

A,  B,    C

1,    2,    4

2,    1,    3

3,    5,    1

];

FinalTable:

LOAD Sum(A) as Value,

  'A' as NewColumn

Resident Table;

Concatenate(FinalTable)

LOAD Sum(B) as Value,

  'B' as NewColumn

Resident Table;

Concatenate(FinalTable)

LOAD Sum(C) as Value,

  'C' as NewColumn

Resident Table;

DROP Table Table;

settu_periasamy
Master III
Master III

One more solution may be

T1:

LOAD '' as dummy,*;

LOAD * INLINE [

    A, B, C

    1, 2, 4

    2, 1, 3

    3, 5, 1

];

T2:

CrossTable(Field, Data)

LOAD dummy,

     A,

     B,

     C

Resident T1;

DROP Table T1;

DROP Field dummy;

NoConcatenate

Final:

LOAD Field,sum(Data) as Data Resident T2 Group by Field;

DROP Table T2;

sunny_talwar

I like this more than my solution. Thanks for sharing this Settu

settu_periasamy
Master III
Master III

Thanks sunindia