Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

IF CONDITION

LOAD

NOTE,

BCOD,

YEAR,

MONTH,

('AC') AS GROUP_CODE,

Sum(if(GROUP_CODE= 'A', 1, if(GROUP_CODE= 'B', -1, 0)) * AMOUNT) as AMOUNT,

('AD') AS GROUP_CODE,

Sum(if(GROUP_CODE= 'A', 1, if(GROUP_CODE= 'D', -1, 0)) * AMOUNT) as AMOUNT

Resident TB

group by NOTE,BCOD, GROUP_CODE,YEAR, MONTH

My above script runs correctly without two lines highlighted in Red. When I add lines in red I get the following message when loading data

field names must be unique within table

Pls help me to rectify my script and I want the lines in red as well

1 Reply
its_anandrjs

In the same table load the two fields name should not same try some thing different like load another table and concatenate this tables but the second table has fields

('AD') AS GROUP_CODE,

Sum(if(GROUP_CODE= 'A', 1, if(GROUP_CODE= 'D', -1, 0)) * AMOUNT) as AMOUNT

Ex:-

Table1:

LOAD

NOTE,

BCOD,

YEAR,

MONTH,

('AC') AS GROUP_CODE,

Sum(if(GROUP_CODE= 'A', 1, if(GROUP_CODE= 'B', -1, 0)) * AMOUNT) as AMOUNT,

Resident TB

group by NOTE,BCOD, GROUP_CODE,YEAR, MONTH

Concatenate(Table1)

Table2:

LOAD

NOTE,

BCOD,

YEAR,

MONTH,

('AD') AS GROUP_CODE,

Sum(if(GROUP_CODE= 'A', 1, if(GROUP_CODE= 'D', -1, 0)) * AMOUNT) as AMOUNT

Resident TB

group by NOTE,BCOD, GROUP_CODE,YEAR, MONTH