title: Returning last and penultimate values in a table in Power BI
body: <p><strong>Hello.</strong></p>
  
  <p>I'm getting to grips with PowerBI and need some guidance on generating three additional columns in a table, which indicate the penultimate and latest quality rating and change in rating for a particular object.</p>
  
  <p>I'm dealing with a huge (and sensitive) dataset, but I've got a mock-example, which is similar to this:</p>
  
  <p><a href="https://i.stack.imgur.com/1s6Ow.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1s6Ow.png" alt="enter image description here"></a></p>
  
  <p>My requirement is quite complex. What I want (see the image below) is a table which summarises:</p>
  
  <ol>
  <li>The Latest Sales Date by Product ID</li>
  <li>The Latest Quality Rating</li>
  <li>The Previous Quality Rating</li>
  <li>A Change column indicating Improvement or Degradation</li>
  </ol>
  
  <p>I've tried various techniques found in forums online to try and get the latest and penultimate sales date including a combination of the CALCULATE and MAX functions. I've managed to generate a column which shows the latest date for each ID, but not the actual value itself. I'm stuck and some help would be really appreciated.</p>
  
  <p><a href="https://i.stack.imgur.com/NNPkd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NNPkd.png" alt="enter image description here"></a></p>