8 Replies Latest reply on Sep 15, 2019 3:08 PM by Richie Gimmel

# Table Calculation with LOD expression and IF statement

Hello Tableau Community,

I am struggling with a table calculation using LOD expression and an IF statement.

Below is my data-set, I would like to calculate the MAX of each SOW for a specific date range (between 01/31/2015 and 03/31/2015).

The formula { FIXED [Sow Id]: MAX([SOW Value])} is working perfectly until I add the condition to it.

See the screen below...

If somebody has any hint please let me know.

PS: I do not want to use filters because I will not be using only one measure.

Thank you very much in advance,

Cheers,

Maxime

• ###### 1. Re: Table Calculation with LOD expression and IF statement

Ok... just find the solution after posting the question...

So I am going to answer to myself and let this topic on the forum maybe it will be helpful for somebody else.

Actually you have to put the IF statement INSIDE the LOD expression or it won't work.

I believe the reason for this is because query hierarchy is (founded on tableau.com):

Extract Filters,

Data Source Filters,

Context Filters,

Dimension Filters,

Measure Filters,

Table Calc Filters,

So the correct calculation will be:

Cheers,

Maxime

14 of 14 people found this helpful
• ###### 2. Re: Table Calculation with LOD expression and IF statement

Yes, you are right !.  Good job Maxime.

Shin

• ###### 3. Re: Table Calculation with LOD expression and IF statement

THANKS SO MUCH Maxime!  Great solution! Finally!:)

Thanks!

Francesco

• ###### 4. Re: Table Calculation with LOD expression and IF statement

Problem solved! Thanks Maxime!

• ###### 5. Re: Table Calculation with LOD expression and IF statement

Hi Maxime,

I am struggling on a similar one too, hope you can give me some tips...

I am hoping to show the Document History Date based on the highest Document History Sequence Number for each Document ID.

My first part of the calculation is { FIXED [Document ID]: max([Document History Sequence Number])}, but when I brought in IF/THEN, or CASE statement, nothing has been working.

I know I am just not putting them in the right place.

Any help is appreciated!

Best Regards,

Patty

• ###### 6. Re: Table Calculation with LOD expression and IF statement

Hi

I have a  data set which contain customer mobile, order_id, order status

i want to filter out all those customers from my view who has any order status other than "delivered"

if a customer has 10 orders which has 9 delivered but 1 other status it also should not come into my view