2 Replies Latest reply on Oct 2, 2012 8:21 PM by mohen leo

# comparing values of two most recent entries

Hi!

I have a table of items, the dates their prices were set/changed, and the prices that were set on those dates.

For each item, I need to find the most recent price and when it was set, and the next-most recent previous price, and then calculate the change.

I.e., data:

ITEM         PRICE          PRICING DATE

table          \$20               1/10/12

table         \$25               2/15/12

table         \$22               4/10/12

chair         \$11               2/20/12

chair          \$13               3/10/12

chair         \$10               5/15/12

chair         \$15              5/20/12

what I need:

ITEM     CURRENT PRICE    PRICE CHANGE     DATE OF MOST RECENT PRICE CHANGE

table      \$22                         - \$3                        4/10/12

chair     \$15                        + \$5                        5/20/12

Seems like a pretty straightforward thing, but I can't figure out how to access the price of the second-most recent price change date.

Thanks!

• ###### 1. Re: comparing values of two most recent entries

A nice example of table calculations - see the attached.

We basically look for the latest date per item using window_max, then we look up a row (sorting by date for each item) for prior price and so on.

Every calculation is a table calculation so you have to set it to use [item] as a 'header' (left side), ignore pricing date (compute using on the right - we have to have it in the level of detail for the window_max) and set the sort order to be date ascending. Do this by right clicking the pill and edit table calculation:

• ###### 2. Re: comparing values of two most recent entries

Awesome, thank you!