Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to use "two" if statement to create a new column?

Dear all

I am using qliksense cloud, after have loaded the data and now i am trying to create a new column( ajouter un champs calcule, in french version) not in the script .

when there is one condition, I've  used syntax like: if(Lib_type_mvt='VL',1,0) when Lib_type_mvt = 'VL', the value of new column is 1 if not is 0. It works for the only one condition. but when there is two conditions like if(Lib_type_mvt= 'VL' or Lib_type_mvt='VC',1,0)

it doesn't work!IMG_0294.JPG

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Can you try this?

= if(Match(Lib_type_mvt, 'VL, 'VC')>0,1,0)

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Could anyone help me?

Thanks a lot.

Je vous remercie par avance.

quriouss
Creator III
Creator III

What error are you getting? Just that "Aucun aperçu"?

You're adding it as a measure (champs calcule) correct? In that case I think you might need to have some sort of aggregation to get a sensible result,


SUM (if(Lib_type_mvt= 'VL' or Lib_type_mvt='VC',1,0))


vishsaggi
Champion III
Champion III

Can you try this?

= if(Match(Lib_type_mvt, 'VL, 'VC')>0,1,0)

Anonymous
Not applicable
Author

Hi

I have  tried SUM() and count() only () yesterday it doesn't work either.

Shuo

Anonymous
Not applicable
Author

Hi

That is great! it works,  thank you so much for your help and also many thanks to simon.

Shuo