title: Excel Power Pivot: Match next non-blank item after date match for customer across two tables using DAX
body: <p>I need to create a calculated column in <strong>Table_Order</strong> that would find the next matching, non-blank <strong>Customer Status</strong> on or after the current <strong>Order Date</strong> for the current row <strong>Customer #</strong>.</p>
  <p>The tricky part is when there is no matching <strong>Customer Status</strong> in <strong>Table_Ship</strong> for a <strong>Customer #</strong> on a particular <strong>Order Date</strong> (please see the orange highlights). The match then needs to be on the next matching <strong>Ship Date</strong> for the <strong>Customer #</strong> where the <strong>Customer Status</strong> is not blank.</p>
  <p>Please could somebody help me and show me the DAX?</p>
  <p>I've spent a long time Googling and have gotten nowhere. I feel like this should be easy!</p>
  <p>Also please bear in mind that these tables are massively simplified versions of my actual work, and any suggestion to reorganise the tables or start from scratch won't help me, I need some DAX please!</p>
  <p>Thanks in advance!</p>
  <p>Phil.</p>
  <p><a href="https://i.stack.imgur.com/hcIed.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hcIed.png" alt="enter image description here" /></a></p>