Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

variables matching


hopefully a very simple problem:

I have different variables with values from 1 to 5, and want to generate one variable out of that who only countes the ones:

V1 (5x1,10x2, 4x3,...)

V2 (6x1, 0x2, 3x3,...)

V3 (12x1, 3x2, 3x3, ...)


new Variable V (5xV1, 6xV2, 12xV3, ...)

Can anyone help?

Thanks a lot and regards


Tags (1)
1 Solution

Accepted Solutions

Re: variables matching

Have a look at the attached, is this what you are looking for?



14 Replies

Re: variables matching

Not sure what your requirement is. Can you elaborate?

V1, V2 and V3 are the names of your variable here???? and your new variable needs to show 5xV1? not sure I understand if x is x or Multiplication sign??

Not applicable

Re: variables matching

Sorry for the misunderstanding, X means the multiplication sign and the new Variable has to show (5,6,12,...) as V1 has five times a 1, V2 has 6 times a 1, V3 has 12 times a 1 and so one. Hoping that makes it more clear... Thanks!

Re: variables matching

And one more question: How is your variable V1 set up right now?

V1 = 1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,... or is it the way you have specified 5x1, 10x2, 4x3??

I am just trying to understand the structure, before I can think of how it can be done.

Valued Contributor II

Re: variables matching

Instead of variable you can create evaluate function

where exp =3*2

evaluate (3*2) returns 6

Not applicable

Re: variables matching

The variables V1 etc. are build of single answers, so for example 1,2,3,2,1,2,2,2,1,2,3,4,...

Not applicable

Re: variables matching

thanks, but I think I have more to look at the variables than at the answers.

maybe with commands like join, match or something in this direction...

Re: variables matching

Try this:

v1 = '1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3'

v2 = '1,1,1,1,1,1,3,3,3'

v3 = '1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,3,3,3'

NewV =

=Count(If(SubField($(v1), ',', ValueLoop(1, 1000,1)) = 1, SubField($(v1), ',', ValueLoop(1, 1000,1)))) & 'xV1 ,' &

Count(If(SubField($(v2), ',', ValueLoop(1, 1000,1)) = 1, SubField($(v2), ',', ValueLoop(1, 1000,1)))) & 'xV2 ,' &

Count(If(SubField($(v3), ',', ValueLoop(1, 1000,1)) = 1, SubField($(v3), ',', ValueLoop(1, 1000,1)))) & 'xV3'

Also find attached the application for your reference.




Not applicable

Re: variables matching

Hi sunny, thanks so far, we're on a good way, but I think its easier if we make it more visual so I also attached an application...

As you can see there are in total 9 variables @q031 to @q039 which can be charted separately. My goal is to chart them in one file so that there are 9 bars side by side as in the lower chart shown. How can I get to this dimension?

Thanks a lot


Re: variables matching

Are you trying to plot 1's on a bar graph for each field?

Community Browser