Truex
Truex

Reputation: 317

Tableau - display last three dates in column

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.

Upvotes: 2

Views: 58

Answers (1)

Nicolaesse
Nicolaesse

Reputation: 2724

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).

Upvotes: 2

Related Questions