title: How to joint two tables in dax using custom condition
body: <p>I have Cartons table, which contains two datatime columns - entering warehouse date and exiting warehouse date. For my report i need to calculate table which shows how many cartons are in the warehouse at the end of the each day. My idea was get number of cartons for each date which have entering date lower than current date and exiting date higher than current date. So i need to translate following sql into dax:</p>
  
  <pre><code>SELECT d.date, COUNT(c.Id) AS 'Count of cartons' FROM #dim d
  INNER JOIN Inventory.Cartons c on d.date between c.EnteringWarehouseTime and c.ExitingWarehouseTime
  GROUP BY d.date
  ORDER By d.date
  </code></pre>
  
  <p>Where dim is table with all dates.</p>
  
  <p>But all joins in dax can be performed only using relations. I can only make cross join of these tables and filter result, but this operation would take to much time. Do i have another options for this?</p>