13 Replies Latest reply on Mar 24, 2014 4:58 PM by Ron Silletti

if statement issue - tableau doesnt read it

what im trying to say is 'if net quote price is > 0 take the value in that field, but if its equal to 0 then add up the expected prod and expected services fields

What is wrong with my syntax???     IF([Quote Total Net Price (\$000s)] > 0 THEN sum([Quote Total Net Price (\$000s)])) ELSEIF ([Quote Total Net Price (\$000s)] = 0 THEN  SUM([Quote Product Net Price (\$000s)]+[Quote Service Net Price (\$000s)])) ELSE END

• 1. Re: if statement issue - tableau doesnt read it

Try breaking the SUM([Quote Product Net Price (\$000s)]+[Quote Service Net Price (\$000s)])) into seperate SUM and remove the final else like the below .

IF([Quote Total Net Price (\$000s)] > 0 THEN sum([Quote Total Net Price (\$000s)])) ELSEIF ([Quote Total Net Price (\$000s)] = 0 THEN  SUM([Quote Product Net Price (\$000s)])+SUM([Quote Service Net Price (\$000s)]))  END

Tyler

• 2. Re: if statement issue - tableau doesnt read it

It is telling me i am missing a parenthesis next to the first 'THEN'???

• 3. Re: if statement issue - tableau doesnt read it

That means you are missing a bracket or have too many brakets ")" "(" try

IF(sum([Quote Total Net Price (\$000s)]) > 0 THEN sum([Quote Total Net Price (\$000s)]))

ELSEIF (sum([Quote Total Net Price (\$000s)])) = 0 THEN

SUM([Quote Product Net Price (\$000s)])+SUM([Quote Service Net Price (\$000s)])  END

• 4. Re: if statement issue - tableau doesnt read it

Still not working. Am I able to call you?

• 5. Re: if statement issue - tableau doesnt read it

Hi Ron

Try this

IF sum([Quote Total Net Price (\$000s)]) > 0 THEN

sum([Quote Total Net Price (\$000s)])

ELSEIF sum([Quote Total Net Price (\$000s)])= 0 THEN

SUM([Quote Total Net Price (\$000s)]+[Quote Service Net Price (\$000s)])

END

Thanks

Karthik

• 6. Re: if statement issue - tableau doesnt read it

Hi,

It is still only taking the totals for the Net Quote Price and not adding the values of Expected Product + Expected Services for records in cases where there is a \$0 for the Net Quote Price. Any ideas?

Are you able to chat on the phone? I could do a WebEx and show you?

Best,

Ron

• 7. Re: if statement issue - tableau doesnt read it

IF sum([Quote Total Net Price (\$000s)]) > 0 THEN

sum([Quote Total Net Price (\$000s)])

ELSEIF sum([Quote Total Net Price (\$000s)])= 0 THEN

SUM([Quote Total Net Price (\$000s)])+SUM([Quote Service Net Price (\$000s)]))

END

Try this one

Thanks

Karthik

• 8. Re: if statement issue - tableau doesnt read it

Argh, same result. Still only adding the Net Quote Price and not considering the other fields.

Here is the updated syntax with updated field values. What I am trying to say in English is "if the net quote price has value greater than 0 for a record, take this value. If the net quote price has a value of 0 then add expected product + expected service. In the end I am looking to get a total for all the records in the sheet. Would it help if I sent the dataset?

IF sum([Quote Total Net Price]) > 0 THEN

sum([Quote Total Net Price])

ELSEIF sum([Quote Total Net Price])= 0 THEN

SUM([Expected Product List Amount])+SUM([Expected Service List Amount])

END

• 9. Re: if statement issue - tableau doesnt read it

yeah just post the workbook with the sample data , that would help

• 10. Re: Re: if statement issue - tableau doesnt read it

I highlighted the 3 value columns. I also attached the workbook.

Plz let me know your thoughts

• 11. Re: Re: if statement issue - tableau doesnt read it

Hi Ron

Some how i face problem when i open the excel in tableau workbook. You have not attached the workbook , Kindly check it

Thanks

Karthik