2 Replies Latest reply on Nov 20, 2017 12:14 PM by Hari Ankem

# New to tableau and request for some help on "creating  calculated field"

My skills are rusty including writing these type of statements,,,

I am trying to create KPI's and their threshold calculations for multiple measures and am currently using two measures to figure it out. I started with one measure and got it working thanks to the tutorials and this forum.

However when I add the other measure with ELSIF (was using ELSE but went with ELSEIF after searching the forum) the below calculation comes out as valid but I am not seeing additional "benchmark measures" and it seem like the "reduction" KPI's and thresholds are being correctly applied to "reduction" but they are also being applied to the "aging" metrics...makes me wonder if I have syntax errors or if I've laid the data out correctly

IF

SUM ([Reduction]) >.20 THEN "Above Benchmark"

ELSEIF

SUM ([Reduction]) < .2 THEN "Below Benchmark"

ELSEIF

SUM ([Aging]) > .9 THEN "Above Benchmark-Aging"

ELSEIF

SUM ([Aging]) < .9 THEN "Below Benchmark-Aging"

END

• ###### 1. Re: New to tableau and request for some help on "creating  calculated field"

Hi Daniel

The issue you face is that in the first 2 clauses in the if statement you account for all your records and none are passed to the last 2

the way the if statement works is that a record is processed until it returns a True at that pint the Then statement is executed and tableau moves on to the next statement

If there is a relationship between the first checks against Reduction and the last 2 Aging you need to connect them using either an And or an Or

if there is no relationship then you need to have 2 ifs and check them independently

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

• ###### 2. Re: New to tableau and request for some help on "creating  calculated field"

You may want to rewrite like this: