Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

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
MVP
MVP

Re: If statement where buckets may overlap

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;

7 Replies
MVP
MVP

Re: If statement where buckets may overlap

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;

Re: If statement where buckets may overlap

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')))

Re: If statement where buckets may overlap

Something like this?

Capture.PNG

florentina_doga
Contributor III

Re: If statement where buckets may overlap

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

Re: If statement where buckets may overlap

thanks

Not applicable

Re: If statement where buckets may overlap

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

Thanks for helping anyway.

Re: If statement where buckets may overlap

Sounds good

Community Browser