Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

afrozahyder
New Contributor

Creating Multiple Account Flags

Table:

Load * inline

[

ID, Type

1, A

1, B

2, A

2, B

2, E

3, D

3, B

3, C

];

FlagTable:

LOAD ID,

1 as Flag1,

    IF(MATCH(UPPER(Type), 'A'), 1) as Flag2,

    IF(MATCH(UPPER(Type), 'B', 'C'),  1) as Flag3

RESIDENT Table;

DROP TABLE Table;

EXIT SCRIPT;

Getting:

Qlik.PNG

WANT:

 

IDFlag1Flag2Flag3
1111
2111
311

Any suggestions?

1 Solution

Accepted Solutions
OmarBenSalem
Esteemed Contributor

Re: Creating Multiple Account Flags

FlagTable:

load max(Flag3) as Flag3 , max(Flag1) as Flag1, max(Flag2) as Flag2 , ID group by ID;

LOAD ID,

1 as Flag1,

    IF(MATCH(UPPER(Type), 'A'), 1) as Flag2,

    IF(MATCH(UPPER(Type), 'B', 'C'),  1) as Flag3

RESIDENT Table;

DROP TABLE Table;

EXIT SCRIPT;

2 Replies
OmarBenSalem
Esteemed Contributor

Re: Creating Multiple Account Flags

FlagTable:

load max(Flag3) as Flag3 , max(Flag1) as Flag1, max(Flag2) as Flag2 , ID group by ID;

LOAD ID,

1 as Flag1,

    IF(MATCH(UPPER(Type), 'A'), 1) as Flag2,

    IF(MATCH(UPPER(Type), 'B', 'C'),  1) as Flag3

RESIDENT Table;

DROP TABLE Table;

EXIT SCRIPT;

OmarBenSalem
Esteemed Contributor

Re: Creating Multiple Account Flags

result:

Capture.PNG

Community Browser