KNOWLEDGE BASE

How to output data according to the latest date using Tableau Prep Builder.


Published: 26 Dec 2022
Last Modified Date: 28 Dec 2022

Question

How to output data according to the latest date using Tableau Prep Builder.

<Example>
Suppose we have a data source with a Customer Name that changes midway through the process.
In such a case, we would output the Latest Customer Name based on the latest date in one field by Customer ID.
User-added image

Environment

  • Tableau Prep Builder

Answer

1. Connect to attached data source 'Sample.xlsx' from Tableau Prep Builder.
2. Click on plus button -> Add a Clean step.
User-added image
3. Create a new calculated field as following.
     Name : Latest Date by Customer
     Calculation :{FIXED [Customer ID] : MAX([Date])}
4. Create a new calculated field as following.
     Name : Latest Record Flag
     Calculation : [Date]=[Latest Date by Customer]
5. Create a new calculated field as following.
     Name : Latest Customer Name
     Calculation : {FIXED [Customer ID]:MAX(IF [Latest Record Flag]=TRUE THEN [Customer Name] END)}
6. Click on plus button -> Add a Clean step.
7. Remove [Latest Date by Customer] and [Latest Record Flag] from data.
User-added image
8. Out put the data source.
Did this article resolve the issue?