Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
Not applicable

Problem with variable in set analysis

I am trying to evaluate one of two expressions, but neither works:

=Sum({1<cod_annomes ={$(#indicador1)}>}  valor) [variable indicador1 = annomes&'AT-1a', and works perfectly)

OR

=Sum({1<cod_annomes =annomes & {'AT-1a'}>}  valor)

But if it works...


=Sum({1<cod_annomes ={'201409AT-1a'}>}  valor)


Is it an error syntax? Can i use a varible in an expression with set analysis?

Thanks in advanced, i tried all that i know and read a lot of questions of this forum...


Greetings

Tags (2)
1 Solution

Accepted Solutions

Re: Problem with variable in set analysis

Hi,

You have Syntax Error

When you write set analysis the value you are comparing always enclosed in {     }

Like in above expression

Sum({1<cod_annomes ={"annomes & {'AT-1a'}"}>} valor)

similarly when you are using Variable you have use =

Like in above expression

Sum({1<cod_annomes ={"$(=indicador1)"}>}  valor)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
5 Replies

Re: Problem with variable in set analysis

Hi,

You have Syntax Error

When you write set analysis the value you are comparing always enclosed in {     }

Like in above expression

Sum({1<cod_annomes ={"annomes & {'AT-1a'}"}>} valor)

similarly when you are using Variable you have use =

Like in above expression

Sum({1<cod_annomes ={"$(=indicador1)"}>}  valor)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
vardhancse
Valued Contributor III

Re: Problem with variable in set analysis

Yes we can use variable in expression with set analysis

=Sum({1<cod_annomes ={'$(#indicador1)'}>}  valor) [variable indicador1 = annomes&'AT-1a', and works perfectly)


for text we need to add ' '

Not applicable

Re: Problem with variable in set analysis

Thanks for your quick and interest Max,


The second expression that you gave me works perfectly, but not the one:

Sum({1<cod_annomes ={"annomes & {'AT-1a'}"}>} valor)


annomes is a field selectable and AT-1a a literal.

Its curious because in variable indicador1 i only do a concatenation like   annomes&'AT-1a'


Do you know what can be happening?


Thanks for your help.

Not applicable

Re: Problem with variable in set analysis

Thanks a lot Sasi,

I am trying to do concatenating annomes&'AT-1a' in the expression, but i fail....

Is any documentation about syntax in Qlikview?

Re: Problem with variable in set analysis

Hi,

Basically issue is comming because of special character like {} and '

You have to use chr(39) for '

chr(123) for {

chr(125) for }

Try it in your searching string

Regards

Great dreamer's dreams never fulfilled, they are always transcended.