4 Replies Latest reply on Feb 22, 2016 5:41 PM by Jason CHEN

# Help--is a calculated field  problem

For example  ：a  calculated field，name is efficiency and values  is  average efficiency/count(equipment) ; average efficiency  = unit / working hours

other is  target，values is 50 number

customer

create a calculated field and user if function values is:   if efficiency >= target and customer  ='china' then 1 else o end,

or   user iif function values is:  iif (efficiency >= target and customer  ='china', 1,0)

both results are getting wrong, how to make it correct？

• ###### 1. Re: Help--is a calculated field  problem

Are you getting wrong numbers or are you getting an error, red pill etc.?

Tableau will give different results for x/y and sum(x)/sum(y) . If you use the former in an equation with aggregation sum, it will be sum(x/y) which is not the same as sum(x)/sum(y). That would be the first place to look at if your results are not what you expected.

• ###### 2. Re: Help--is a calculated field  problem

is getting an error shows：unable to blend the aggregate and non aggregate parameters with this function.

calculated field's efficiency has been an aggregation parameters, but calculate field's customer is not an aggregation parameters, both can't use in IF AND iif function.

however, I need to get results by contrast both condition

there for I am looking for other way to deal with

• ###### 3. Re: Help--is a calculated field  problem

You can't mix aggregates and disaggregates in a calculated field and blended fields always come as aggregates.

Can't you make your fields aggregates e.g. instead of customer='china' try ATTR(customer)='china' or MAX(customer)='china'

• ###### 4. Re: Help--is a calculated field  problem

Hi Bora Beran

Thank you!  It is work. get what I want.