Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

create new field in the script - Cross table

Hi!

I have the following Table1 in my script:

Table1:

CrossTable(Month, Val, 1)

LOAD INDICATOR,

    [1] as Jan,

    [2] as Feb,

    [3] as Mar,

    [4] as Apr,

    [5] as May,

    [6] as Jun,

    [7] as Jul,

    [8] as Aug,

    [9] as Sep,

    [10] as Oct,

    [11] as Nov,

    [12] as Dec

FROM

xxxx

INDICATOR can have 4 possible values ('A','B','C','D'). All the other columns have numerical values.

I would like to add a new INDICATOR value called 'AB, which are the sum of the values where INDICATOR is 'A' or 'B'

Thank you!

1 Solution

Accepted Solutions
sunilkumarqv
Specialist II
Specialist II

Table1:

CrossTable(Month, Val, 1)

LOAD

//INDICATOR,

If(INDICATOR='A' or INDICATOR='B','AB',INDICATOR) as INDICATOR,

    [1] as Jan,

    [2] as Feb,

    [3] as Mar,

    [4] as Apr,

    [5] as May,

    [6] as Jun,

    [7] as Jul,

    [8] as Aug,

    [9] as Sep,

    [10] as Oct,

    [11] as Nov,

    [12] as Dec

FROM

xxxx

View solution in original post

2 Replies
sunilkumarqv
Specialist II
Specialist II

Table1:

CrossTable(Month, Val, 1)

LOAD

//INDICATOR,

If(INDICATOR='A' or INDICATOR='B','AB',INDICATOR) as INDICATOR,

    [1] as Jan,

    [2] as Feb,

    [3] as Mar,

    [4] as Apr,

    [5] as May,

    [6] as Jun,

    [7] as Jul,

    [8] as Aug,

    [9] as Sep,

    [10] as Oct,

    [11] as Nov,

    [12] as Dec

FROM

xxxx

Not applicable
Author

Hi,

Table1:

CrossTable(Month, Val, 1)

LOAD

If(INDICATOR='A' or INDICATOR='B','AB',INDICATOR) as INDICATOR,

    [1] as Jan,

    [2] as Feb,

    [3] as Mar,

    [4] as Apr,

    [5] as May,

    [6] as Jun,

    [7] as Jul,

    [8] as Aug,

    [9] as Sep,

    [10] as Oct,

    [11] as Nov,

    [12] as Dec

FROM

<Table_Name>;

i think it might help u.