Tableau - display last three dates in column

40 Views Asked by At

I have the following objects in Tableau dashboard: change_id and entry_date

Change_id is unique but entry_date can appear multiple times due to date of change modification.

As an example:

CH123 1/1/2022 1/3/2023 1/4/2023 1/5/2024

How do I create a field to display only last two dates?

I was trying the following: RANK(MAX({FIXED [Change ID]:max([Entry Date])})) and then filtering out only 1 and 2 values. It is working fine unless there are multiple change requests and Tableau starts to assign continuous numbers to all change requests.

1

There are 1 best solutions below

0
Nicolaesse On

Probably you can use this snippet (source):

// Second max date overall
{ FIXED : MAX(
    IF [US Release Date]={ FIXED : MAX([US Release Date])}
    THEN NULL 
    ELSE [US Release Date] END
)}

adding change_id to the dimensions to include into the context (so after the FIXED words).