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: 
Not applicable

Multiple comparison using variable

Hi,

I am having 12 variables - var1 , var2 , var3, ... , var12 . I would like to compare these variables like var1 = var2 = var3 = ... = var12 . How can we achieve this in QlikView ? Is there any in-built function ?

Best Regards,

Arun.

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

See attached QVW, there are 2 examples: with If and usin SubStringCount.

The first is a common Sequence IF compare fisrt variable VS the rest of variables.

She Second use a variable with a concatenation of vVar2 to vVar12 then using SubStringCount() Function create a comparission using and if. (If all variables are same than the first variable function return 11).

Best regards and sorry  for my English :S

View solution in original post

10 Replies
its_anandrjs

Create another variable in UI by click Ctrl+Alt+V for Variable overview and there create a variable and write the expression for variable.

Not applicable
Author

Hi Anand,

In that case many variables needs to be created. Right ?

Eg:

var1 = 'FY13-Q1'

var2 = 'FY13-Q2'

var3 = 'FY13-Q3'

.

.

var12 = 'FY12-Q1'

I would like to compare all variables like var1 = var2 = var3 = ... = var12 .

Best Regards,

Arun.

sorrakis01
Specialist
Specialist

Hi,

Why don't use the secuence IF?

Cy

Not applicable
Author

Hi Jordi,

I don't know about Sequence IF. Could you please provide an example ?

Best Regards,

Arun.

Not applicable
Author

Hi Arun, what's the expected output of the comparison?

Not applicable
Author

Hi Chander,

If all values are same then 'Valid'.

If all are different, then 'Invalid'

Not applicable
Author

Jordi's solution comes to my mind as well. Am not aware of a more elegant solution. Try the following

If( v1 = v2 and v2 = v3 and v3 = v4 and v4 = v5 and v5 = v6 and v6=v7 and v7=v8 and v8 = v9 and v9=v10 and v10 = v11 and v11 = v12, 'Valid', 'Not valid')

you will need to use variable or $(variable) depending on how you have defined your variables.

Not applicable
Author

Hi,

See attached QVW, there are 2 examples: with If and usin SubStringCount.

The first is a common Sequence IF compare fisrt variable VS the rest of variables.

She Second use a variable with a concatenation of vVar2 to vVar12 then using SubStringCount() Function create a comparission using and if. (If all variables are same than the first variable function return 11).

Best regards and sorry  for my English :S

Not applicable
Author

Oswaldo, the concatenation followed by substringcount alternative was brilliant.