Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
If you are a Qlik Insight Bot user, join this collaborative group: JOIN GROUP
Highlighted
New Contributor III

Variables and if statements

Having difficulty with using variables in IF statements (being used as measures). Trying to use these expressions in a straight table. The variables themselves work fine in the tables, but trying to use them in conjunction with the IF statements are not working? Can't figure out why they won't work ... usually get back (zero) or a blank field. Any help is appreciated.

Example:

vExample = Sum(sales)

if ( parts_age <= 90, $(vExample) )  ----- Does not seem to work?

if ( parts_age = 90, $(vExample) )  ----- Does seem to work ???

Is there an issue with using relational operators in IF statements????

Tags (3)
4 Replies
Highlighted
Esteemed Contributor III

Re: Variables and if statements

it works i think.

u can try below simple  example

try: if ($(vStartYear)< 2012,'YES','No')

Highlighted
Not applicable

Re: Variables and if statements

First check whether your variables getting data or not then use it

Valued Contributor III

Re: Variables and if statements

Hi,

while creating new variable make sure '=' was removed for the Variable value.


= Sum(sales)

Highlighted
MVP
MVP

Re: Variables and if statements

There's nothing wrong with either statement. To get more useful help and not just guesswork, I suggest that you upload a small sample qvw to illustrate the problem.

Preparing examples for Upload - Reduction and Data Scrambling

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein