title: power BI Taking MIN and Max date by comparing two tables
body: <p>I have three table namely Allitems, InItems and OutItems. The main table is Allitems which is related to the other two table with IN_OUT_ID.
  I have been able to calculate the min and max date based on the IDs for each of the </p>
  
  <p>Dataset </p>
  
  <p><a href="https://i.stack.imgur.com/sRYws.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sRYws.jpg" alt="enter image description here"></a></p>
  
  <p>table using the below DAX Formula</p>
  
  <p>For InItems tables</p>
  
  <pre><code>Min_Start_Date = CALCULATE( MIN(InItems[InDate]), ALLEXCEPT( InItems, InItems[IN_ID] ))
  Max_end_Date =  CALCULATE( MAX(InItems[InDate]), ALLEXCEPT( InItems, InItems[IN_ID] ))
  </code></pre>
  
  <p>For OutItems table</p>
  
  <pre><code>Min_Start_Date = CALCULATE( MIN(OutItems[OutDate]), ALLEXCEPT( OutItems, OutItems[OUT_ID]))
  Max_end_Date = CALCULATE( MAX(OutItems[OutDate]), ALLEXCEPT( OutItems, OutItems[OUT_ID] ))
  </code></pre>
  
  <p>the relationship i have change the direction to flow both ways</p>
  
  <p><a href="https://i.stack.imgur.com/0yRCF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0yRCF.jpg" alt="enter image description here"></a></p>
  
  <p>I am trying to bringback min and max date by comparing the the min and max date from OutItems and Allitems and use it as a column in Allitems table. For example taking IN_ID 1, the Min date is  08/01/2019. I will also take the min date of OUT_ID which is  03/02/2019. Then I want the min date between these two date which is 08/01/2019.
  Can anybody help on how I can achieve this</p>
  
  <p>Expected outcome</p>
  
  <p><a href="https://i.stack.imgur.com/Gu7hb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gu7hb.jpg" alt="enter image description here"></a></p>
  
  <p>I am open to any question thanks</p>