<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculated Column to find date where the sum of units meets certain value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2806805#M88596</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="433015" data-lia-user-login="v-yueyunzh-msft" class="lia-mention lia-mention-user"&gt;v-yueyunzh-msft&lt;/a&gt;&amp;nbsp;I'm unable to figure out how to attach an example file. Your example looks fine just need to add 'Location ID'. Please note that the delivery_table has 3 million rows and the transaction_table has 17 million rows. I did try and run your original code but, was met with the below error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;lt;ccon&amp;gt;There's not enough memory to complete this operation. Please try again later when there may be more memory available.&amp;lt;/ccon&amp;gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Sep 2022 15:43:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-09-29T15:43:59Z</dc:date>
    <item>
      <title>Calculated Column to find date where the sum of units meets certain value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2803238#M88289</link>
      <description>&lt;P&gt;Delivery_Table: Date a delivery was made and the number of units delivered. Table includes maximum delivery capacity.&lt;/P&gt;&lt;P&gt;Arrival_Units =&amp;nbsp;( Delivery_Table[Capacity] - Delivery_Table[UnitsDelivered] )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Transaction_Table: Date and number of units sold&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the Delivery_Table&amp;nbsp;I want to make a calculated column called *Delivery_Table[Arrival Units Expired Date] where the Transaction_Table[Transaction Date] &amp;gt;= Delivery_Table[Delivery Date] &amp;amp;&amp;amp; sum of Transaction_Table[Units Sold] &amp;gt;= [Arrival_Units] and returns the Transaction_Table[Transaction_Date] this occurs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Delivery_Table&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Delivery Date&lt;/TD&gt;&lt;TD&gt;Capacity&lt;/TD&gt;&lt;TD&gt;Delivered Units&lt;/TD&gt;&lt;TD&gt;Arrival Units&lt;/TD&gt;&lt;TD&gt;*Arrival Units Expired Date&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/1/2022&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;75&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;TD&gt;9/6/2022&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Transaction Table&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Transaction Date&lt;/TD&gt;&lt;TD&gt;Units Sold&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/1/2022&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/2/2022&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/3/2022&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/4/2022&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/5/2022&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/6/2022&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9/7/2022&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 15:01:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2803238#M88289</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-28T15:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Column to find date where the sum of units meets certain value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2804657#M88403</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can refer to :&lt;/P&gt;
&lt;P&gt;(1)This is my test data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2)We can create a calculated column in 'Delivery_Table' :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;*Arrival Units Expired Date = var _cuurent_arr='Delivery_Table'[Arrival Units]
var _current_deliver_date = 'Delivery_Table'[Delivery Date]
var _t= FILTER('Transaction Table' , 'Transaction Table'[Transaction Date] &amp;gt;=_current_deliver_date) 
var _t2= ADDCOLUMNS(_t , "sum" , SUMX(FILTER(_t , [Transaction Date] &amp;lt;=EARLIER('Transaction Table'[Transaction Date])) , [Units Sold]))
var  _t3 =FILTER(_t2 , [sum] &amp;gt;= _cuurent_arr)
return 
MINX(_t3,[Transaction Date])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(3)Then we can meet your need , the result is as follows:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this method does not meet your needs, you can provide us with your special &lt;STRONG&gt;sample data&lt;/STRONG&gt; and the &lt;STRONG&gt;desired output sample&lt;/STRONG&gt; data in the form of &lt;STRONG&gt;tables&lt;/STRONG&gt;, so that we can better help you solve the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 02:14:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2804657#M88403</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-09-29T02:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Column to find date where the sum of units meets certain value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2806695#M88584</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="433015" data-lia-user-login="v-yueyunzh-msft" class="lia-mention lia-mention-user"&gt;v-yueyunzh-msft&lt;/a&gt;&amp;nbsp;Thank you for your reply. I'm confident this will work however, I failed to mention in my previous post there is a 'Location ID' to match to on both tables. Secondly, the next column I'll be making would be 'Delivered Units Expired Date'. I'm not fully grasping the ADDCOLUMNS within the variables so, helping me with both would help me get there. Below is the example tables....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 15:45:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2806695#M88584</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T15:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Column to find date where the sum of units meets certain value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2806805#M88596</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="433015" data-lia-user-login="v-yueyunzh-msft" class="lia-mention lia-mention-user"&gt;v-yueyunzh-msft&lt;/a&gt;&amp;nbsp;I'm unable to figure out how to attach an example file. Your example looks fine just need to add 'Location ID'. Please note that the delivery_table has 3 million rows and the transaction_table has 17 million rows. I did try and run your original code but, was met with the below error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;lt;ccon&amp;gt;There's not enough memory to complete this operation. Please try again later when there may be more memory available.&amp;lt;/ccon&amp;gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 15:43:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2806805#M88596</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T15:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated Column to find date where the sum of units meets certain value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2807576#M88685</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use this dax , then you can add the "Location ID" condition.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;*Arrival Units Expired Date = var _cuurent_arr='Delivery_Table'[Arrival Units]
var _current_deliver_date = 'Delivery_Table'[Delivery Date]
var _cuurent_ID = 'Delivery_Table'[Location ID]
var _t= FILTER('Transaction_Table' , 'Transaction_Table'[Transaction Date] &amp;gt;=_current_deliver_date &amp;amp;&amp;amp; 'Transaction_Table'[Location ID] =_cuurent_ID) 
var _t2= ADDCOLUMNS(_t , "sum" , SUMX(FILTER(_t , [Transaction Date] &amp;lt;=EARLIER('Transaction_Table'[Transaction Date])) , [Units Sold]))
var  _t3 =FILTER(_t2 , [sum] &amp;gt;= _cuurent_arr)
return 
MINX(_t3,[Transaction Date])&lt;/LI-CODE&gt;
&lt;P&gt;And i use the new test data, the result is as follows:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If this method does not meet your needs, you can provide us with your special &lt;STRONG&gt;sample data&lt;/STRONG&gt; and the &lt;STRONG&gt;desired output sample&lt;/STRONG&gt; data in the form of &lt;STRONG&gt;tables&lt;/STRONG&gt;, so that we can better help you solve the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2022 01:46:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-Column-to-find-date-where-the-sum-of-units-meets/m-p/2807576#M88685</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-09-30T01:46:06Z</dc:date>
    </item>
  </channel>
</rss>

