4 Replies Latest reply on Jun 30, 2016 2:37 AM by Justus Niemzok

# MAX(Date) in a calculation field

Hello together,

i have a question to a calculation.

Can i program a calculation field that includes a MAX-function?

Like this:

ZN(IF MAX([Datbuch])

AND ART='D'

THEN [Nw1Gesnettoprofit]

END)

Is in Tableau a opportunity output the last order date?

Thanks

Lea

• ###### 1. Re: MAX(Date) in a calculation field

Hi Lea,

Here you go:

• ###### 2. Re: MAX(Date) in a calculation field

Hi Lea,

This is definitely possible. I upload an example workbook including the calculation necessary for fixing the last order date across the entire data set.

Max([Order Date]) is an absolute valid expression. It will return the last date in your data depending on you level of detail in the view. Look at an illustrating example:

1. This simply shows the last order date per sub-category. In the marks card you the simple calculation of MAX(Order Date) which results in the same date across the Sub-Categories.

2. Bringing in a another level of detail - Customer Name - into the view we notice that the result for the same calculation - Max(Order Date) - changes.

3. Using an LoD calculation ( See link about this topic) we can fix the MAX(Order Date) across the data set. The calculation is: {FIXED : MAX([Order Date])}.

The rest is using this calculation in the logical statement (If else) as you put it.

Let me know if this answer helps you or if have further questions.

Have a closer look at the attached Workbook.

Kind regards,

Justus

InterWorks

• ###### 3. Re: MAX(Date) in a calculation field

Hi Justus,

thanks for your help  thats a very good solution for my problem. With the LOD-Funktion FIXED i could program a calculation field and my result is correct.

kind regards

Lea

1 of 1 people found this helpful
• ###### 4. Re: MAX(Date) in a calculation field

That is great to hear!