Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement where buckets may overlap

CUS IDCCSavCur
1111
2100
3001
4011
5011
6010
7010
8010
9011

Logic is something like,

if CC = 1 then 'Cards',

if Sav = 1 and Cur = 1, 'Marked'

Please can you help with the correct IF statement for this. Some CUS ID's should end up with 2 values; ie they fall into both the Cards and Marked bucket

Thanks

Stu

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You need to create a link table, like

LOAD [CUS ID]

          'Cards' as NewField

RESIDENT YourTable

WHERE CC =1;

CONCATENATE

LOAD [CUS ID]

          'Marked' as NewField

RESIDENT YourTable

WHERE Sav=1 AND Cur =1;

View solution in original post

7 Replies
swuehl
MVP
MVP

You need to create a link table, like

LOAD [CUS ID]

          'Cards' as NewField

RESIDENT YourTable

WHERE CC =1;

CONCATENATE

LOAD [CUS ID]

          'Marked' as NewField

RESIDENT YourTable

WHERE Sav=1 AND Cur =1;

sunny_talwar

May be like this:

If(CC = 1 and Sav = 1 and Cur = 1, 'Both',

If(CC = 1, 'Cards', If(Sav = 1 and Cur = 1, 'Marked')))

sunny_talwar

Something like this?

Capture.PNG

florentina_doga
Partner - Creator III
Partner - Creator III

use this

load *,

if(len(cards)<>0 and len(marked),1,0) as flag;

load *,

if( CC = 1, 'Cards') as cards,

if (Sav = 1 and Cur = 1, 'Marked') as marked

;

load * inline [CUSID,    CC,    Sav,    Cur

1,    1,    1,    1,

2,    1,    0,    0,

3,    0,    0,    1,

4,    0,    1,    1,

5,    0,    1,    1,

6,    0,    1,    0,

7,    0,    1,    0,

8,    0,    1,    0,

9,    0,    1,    1];

flag is 1 for not empty cards and not empty marked

Not applicable
Author

thanks

Not applicable
Author

Hi Sunny, thanks for the help but i needed multiple values for those Customers who appear more than once

Thanks for helping anyway.

sunny_talwar

Sounds good