Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
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.
caseyjohnson
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
Chanty4u
Esteemed Contributor III

Re: Variables and if statements

it works i think.

u can try below simple  example

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

Not applicable

Re: Variables and if statements

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

vardhancse
Valued Contributor II

Re: Variables and if statements

Hi,

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


= Sum(sales)

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
Community Browser