4 Replies Latest reply on Oct 19, 2016 5:14 PM by Jatin Kakani

# Calculation keeping one parameter constant - LOD Expression

Hi guys,

I have an expression for yield calculation as yield = completed/completed+scrapped.

Now I have different views for showing the yield like for example, yield by product group.

What I want is for every product group, just the numerator i.e. number of completed lots should change however the denominator should remain constant i.e. total count of completed and scrapped lots for all the product groups.

Normally if I fetch the product group dimension to the pane and do the calculation, what happens is Tableau first filters out all the lots based on product group and then performs the calculation.
However, in my case the denominator needs to remain constant.

I tried to use the LOD expression FIXED for the denominator, however Tableau doesn't allow me to do so saying aggregated and no aggregated functions cannot be used together.

Thanks.

Regards,

Jatin

• ###### 1. Re: Calculation keeping one parameter constant

Try putting your LOD inside a SUM, SUM([My LOD]).  This may solve your aggregate non-aggregate error.

• ###### 2. Re: Calculation keeping one parameter constant

Hi Ivan,

I tried using SUM, however I am not able to achieve what I want.

I am not sure if I am using the LOD expression in a right way.

Below is the LOD expression I am trying to use:

COUNTD([Completed])

/

(

SUM({FIXED [Product Desc]:COUNTD([Completed])})

+

SUM({FIXED [Product Desc]:COUNTD([Terminated or Scrapped])})

)

Regards,

Jatin

1 of 1 people found this helpful
• ###### 3. Re: Calculation keeping one parameter constant

Hi Jatin,

What does it give you and how does it differ from what you want?

Have you tried?

COUNTD([Completed])

/

SUM (

({FIXED [Product Desc]:COUNTD([Completed])})

+

({FIXED [Product Desc]:COUNTD([Terminated or Scrapped])})

)

1 of 1 people found this helpful
• ###### 4. Re: Calculation keeping one parameter constant

Hi Ivan,

I just tried the expression you have given.

However, it gives me the same results as it would have given without using the FIXED clause.

So basically, for each product category it first filters out the lots for that particular product and then performs the calculation.

So my requirement of just varying the numerator for each product category keeping the denominator always constant is not being met.

Regards,

Jatin