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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
stonecold111
Creator III
Creator III

If clause with multiple fileds

Hi qlikss

I have a table

NUM      name.      Name2

1.            0.                  0

2.             John.          0

3.             0.                  Roc

I want my output table like this

 

NUM      name.      Name2.    Comment

1.            0.                  0.              Name is zero

1.             0.                  0.              Name2 is zero

2.             John.          0.              Name2 is zero

3.             0.                  Roc.         Name is zero

Someone help me

Labels (2)
1 Solution

Accepted Solutions
QFabian
MVP
MVP

Hi @stonecold111 , a lot of fun with this, i just create this example, considering that the dots doesnt exists, if they exists, just replace 0 with '0.' :

DataX:
Load * INLINE [
Num, Name, Name2
1, 0,0
2,John Cena,0
3,0, The Rock
];

Comment:
Load
Num,
if(Name = 0, 'Name is Zero') as Comment
Resident DataX;

Load
Num,
if(Name2 = 0, 'Name2 is Zero') as Comment
Resident DataX;

 

This is the result,

QFabian_0-1613572101812.png

 

please consider this :

QFabian_1-1613572134361.png

 

Let my know if this is an acceptable solution!

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.

View solution in original post

9 Replies
stonecold111
Creator III
Creator III
Author

@swuehl 

Help me 

Rqlik1
Contributor II
Contributor II

Try if([name.] = '0.', 'Name is zero', if([Name2.] = '0.', 'Name2 is zero', 'Not zero'))

stonecold111
Creator III
Creator III
Author

But I want name is zero and name2 is zero

For same number

stonecold111
Creator III
Creator III
Author

I want same comments that shown above

QFabian
MVP
MVP

Hi @stonecold111 , a lot of fun with this, i just create this example, considering that the dots doesnt exists, if they exists, just replace 0 with '0.' :

DataX:
Load * INLINE [
Num, Name, Name2
1, 0,0
2,John Cena,0
3,0, The Rock
];

Comment:
Load
Num,
if(Name = 0, 'Name is Zero') as Comment
Resident DataX;

Load
Num,
if(Name2 = 0, 'Name2 is Zero') as Comment
Resident DataX;

 

This is the result,

QFabian_0-1613572101812.png

 

please consider this :

QFabian_1-1613572134361.png

 

Let my know if this is an acceptable solution!

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
Saravanan_Desingh

Try this,

tab1:
Load * INLINE [
Num, Name, Name2
1, 0,0
2,John Cena,0
3,0, The Rock
];

tab1X:
CrossTable(Names, Value)
LOAD * Resident tab1;

Left Join(tab1)
LOAD Num, Concat(DISTINCT If(Value=0,Names&' is Zero'),', ') As Comment
Resident tab1X
Group By Num;

Drop Table tab1X;
Saravanan_Desingh

Output:

commQV02.PNG

stonecold111
Creator III
Creator III
Author

Thank s Fabian.

Worked like charm.

Even the names that I have in my mind are jhon cena and Dwayne the rock  Johnson when I'm typing my sample data😁 

You guessed it right.

Another way of doing is with cross table.

Thanks all of you.

 

stonecold111
Creator III
Creator III
Author

Thanks sarand7. 

I can accept only one reply as solution.

You both are awesome.