Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
caseyjohnson
Contributor III
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????

4 Replies
Chanty4u
MVP
MVP

it works i think.

u can try below simple  example

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

Not applicable

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

vardhancse
Specialist III
Specialist III

Hi,

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


= Sum(sales)

jonathandienst
Partner - Champion III
Partner - Champion III

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