1 Reply Latest reply on Jun 26, 2013 8:15 AM by Mark Holtz

# Trying to identify the 2 most recent date values, so I can break the data into 2 separate columns

My data is as follows:

Date          Amount

1/1/2013     \$8.00

4/10/2013   \$11.00

5/7/2013     \$5.00

I want to create 2 calculations, one for the most recent date (Max) and one for the 2nd most recent date, such that I sum the values for each respective date...

For example, for "My Max Amount", the result will be \$5.00 and for whatever date is the 2nd most recent, the result would be \$11.00.

Then over time as data gets added to the table, it would naturally recompute based on whatever dates ate the most and 2nd most recent...

How can I accomplish?

• ###### 1. Re: Trying to identify the 2 most recent date values, so I can break the data into 2 separate columns

Hi Dan,

I believe you could utilize the INDEX() function which creates a rank value within a partition. You can then do something to the effect of setting the rank by descending date so the most recent is always #1 and the 2nd most recent is always #2. You can access those figures in other calculations...

It gets a bit tricky to explain without an example, but maybe you'll be able to get help from this in-depth conversation re:Index Table Calculations .

If you can't figure it out, you're probably going to need to post a packaged workbook with your data, or recreate your situation with example data.

http://onlinehelp.tableausoftware.com/current/pro/online/en-us/help.htm#functions_functions_tablecalculation.html