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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help in Scripting

Hi All,

I have a table as shown below:

ItemHeader 2Header 3
AMixedC1
AMixedC2
BMixedC1
CMixedC2

I wish to create the below table:

ItemHeader 2Test
AMixedY
BMixedN
CMixedN

Thanks,

Asma

Labels (1)
10 Replies
awhitfield
Partner - Champion
Partner - Champion

HI Asma,

what does the TEST signify?

Andy

Not applicable
Author

Test is a new column which would be created based on the values present in Header3. If a particular value in Item column has both C1 and C2 values in Header3, then the value should be marked as Y in Test column

amit_saini
Master III
Master III

Hi Asma,

What is your Test condition???

Thanks,

AS

jagan
Partner - Champion III
Partner - Champion III

Hi,

Data:

LOAD

*

FROM DataSource;

LEFT JOIN(Data)

LOAD

Item,

Header2,

If(Count(Item)  > 1, 'Y', 'N') AS Test

RESIDENT Data;

Regards,

Jagan.

Not applicable
Author

Looking your tables, I think you want this...

=if(Item ='A','Y','N')

What's your test condition?

anbu1984
Master III
Master III

Check replies in your previous post

Re: Help in Scripting

qlikviewwizard
Master II
Master II

Hi Jagan,

Used the same script but getting below error.

Invalid expression

left join ( Data )

LOAD

Item,

[Header 2],

If(Count(Item)>1, 'Y', 'N') as Test

RESIDENT Data

Please advise.

maxgro
MVP
MVP

1.png

s1:

LOAD Item,      [Header 2],      [Header 3]

FROM

[https://community.qlik.com/thread/161786]

(html, codepage is 1252, embedded labels, table is @1);

s2:

load   Item,   [Header 2],

  if(Test='C1-C2','Y','N') as Test;

load   Item,   [Header 2],

  Concat(DISTINCT [Header 3], '-', [Header 3]) as Test

Resident   s1

group by   Item,     [Header 2];

ramoncova06
Partner - Specialist III
Partner - Specialist III

you can also do this with a preceding load

FinalResult:

Load

Item,

[Header 2]

if(HeaderCount) > 1 ,'Y', 'N') as Test;

load

count([Header 3]) as HeaderCount,

Item,

[Header 2]

group by

Item,

[Header 2];

load

Item,

[Header 2],

[Header 3]

from table .....;