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

if condition in load statement

Hi All,

table:

load

id,

column 1

from test.qvd

The information in the columns are like below

id  column1

1   a

2  b

3  c

4  a

5  c

6  b

7  d

8 d

I would like to group all the a and b to name the column ab and c and d  to be column cd.

I tried to use if function in the load script but I think this is not the right option.

Could you please advice ?

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Can you use like below

LOAD id, column1, If(WildMatch(column1,'A','B'), column1) as ab, If(WildMatch(column1,'C','D'), column1) as cd;

LOAD * Inline [

id,  column1

1 ,  A

2 , B

3 , B

4,  C

5,  D

6,  D

7,  A

8, C

9, A

10, B

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

8 Replies
Anil_Babu_Samineni

What would be the output from given data

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
0li5a3a
Creator III
Creator III
Author

Main qvdMy new Chart1My new Chart2
IDNameStatusIDNameStatusIDNameStatus
1JoA1 A4MoD
2MoB2 B5toD
3toB3 B6MoA
4MOC7 A8toC
5MoD9 A
6toD10 B
7MoA
8toC
9MoA
10toB
Anil_Babu_Samineni

Like this?

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
0li5a3a
Creator III
Creator III
Author

Yes

0li5a3a
Creator III
Creator III
Author

I want to create chart1 and chart2 using first table because this is my qvd.

I  tried something like this:

table:

load

id,

column1,

if(column1= 'a',if(column1='b')) as ab,

     if(column1 = 'c', if(column1= 'd)) as cd'

from test.qvd

Then I want to make a table box to look like this:

chart1

id     ab       

1      a

2      b

3      a

and

chart2

id  cd

4   c

5   d

6   c

Anil_Babu_Samineni

Can you use like below

LOAD id, column1, If(WildMatch(column1,'A','B'), column1) as ab, If(WildMatch(column1,'C','D'), column1) as cd;

LOAD * Inline [

id,  column1

1 ,  A

2 , B

3 , B

4,  C

5,  D

6,  D

7,  A

8, C

9, A

10, B

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Kushal_Chawda

Chart 1


Dimension:

ID

Name


Expression:

only({<Status={'A','B'}>}Status)



Chart 2


Dimension:

ID

Name


Expression:

only({<Status={'C','D'}>}Status)

0li5a3a
Creator III
Creator III
Author

A big thank you!