title: PowerBI: Ranking values within a date range
body: <p>I have a dataset containing records of used car prices and I want to distinguish between &quot;low&quot;, &quot;medium&quot; and &quot;high&quot; prices. For this I would like to rank a given list price to other list prices of the same car model being published for sale at the same time. It is a quite large dataset with ~500k used car listings/ads.</p>
  <p>--&gt; I try to estimate how quickly a certain car model typically is sold if the price is in the &quot;low&quot;, &quot;medium&quot;, &quot;high&quot; categories</p>
  <p>Columns</p>
  <ul>
  <li>Price</li>
  <li>Car model</li>
  <li>Publishing date</li>
  <li>Sold date (if it is sold)</li>
  <li>Active (the publishing date and sold date defines whether a car is active at a given date)</li>
  </ul>
  <p>What I would ideally like to do:</p>
  <ul>
  <li>For a given price observation: how does the price rank to other price observations that were also for sale at the same time</li>
  </ul>
  <p>I imagine this would be a calculated column, stating something like the following:</p>
  <ul>
  <li>Rank formula</li>
  <li>Filter:</li>
  <li>Exclude observations created after this observation and sold before this observation</li>
  <li>Include observations created before and sold after/not sold relative to this observation</li>
  <li>Include observations of the same car model</li>
  </ul>
  <p>Could anyone please help me out and point me in the right direction of which formulas to use? Would be highly appreciated!</p>