<?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 Cumulative sum based on other columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sum-based-on-other-columns/m-p/3026412#M103218</link>
    <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I've been struggling to write a calculated column to solve the following issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got 4 columns: SKU,PO,Qty ordered and Qty on backorder. I need to create a column called "can_clear_backorders", that will calculate the amount of backorders a PO can clear based on the qty ordered but this needs to be a cumulative sum and it also needs to reset when there is a new value in column SKU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how can I achive this? Sorry if my explanation is not clear enough, I've attached an image with the expected result as an example.&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>Tue, 17 Jan 2023 16:06:28 GMT</pubDate>
    <dc:creator>georgec96</dc:creator>
    <dc:date>2023-01-17T16:06:28Z</dc:date>
    <item>
      <title>Cumulative sum based on other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sum-based-on-other-columns/m-p/3026412#M103218</link>
      <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I've been struggling to write a calculated column to solve the following issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got 4 columns: SKU,PO,Qty ordered and Qty on backorder. I need to create a column called "can_clear_backorders", that will calculate the amount of backorders a PO can clear based on the qty ordered but this needs to be a cumulative sum and it also needs to reset when there is a new value in column SKU.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas how can I achive this? Sorry if my explanation is not clear enough, I've attached an image with the expected result as an example.&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>Tue, 17 Jan 2023 16:06:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sum-based-on-other-columns/m-p/3026412#M103218</guid>
      <dc:creator>georgec96</dc:creator>
      <dc:date>2023-01-17T16:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum based on other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sum-based-on-other-columns/m-p/3027311#M103277</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="357242" data-lia-user-login="georgec96" class="lia-mention lia-mention-user"&gt;georgec96&lt;/a&gt; , You back order logic is not clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But windows function with partitioned by can help&lt;/P&gt;
&lt;P&gt;Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: &lt;A href="https://youtu.be/nxc_IWl-tTc" target="_blank" rel="noopener"&gt;https://youtu.be/nxc_IWl-tTc&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=cN8AO3_vmlY&amp;amp;t=31980s" target="_blank"&gt;https://www.youtube.com/watch?v=cN8AO3_vmlY&amp;amp;t=31980s&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The information you have provided is not making the problem clear to me. Can you please explain with an example. &lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Appreciate your Kudos.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 02:13:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sum-based-on-other-columns/m-p/3027311#M103277</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2023-01-18T02:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sum based on other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sum-based-on-other-columns/m-p/3030563#M103544</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="357242" data-lia-user-login="georgec96" class="lia-mention lia-mention-user"&gt;georgec96&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can try the following methods&lt;/SPAN&gt;&lt;SPAN&gt;.&amp;nbsp;&lt;/SPAN&gt;You need to add an index column to Power Query first.&lt;/P&gt;
&lt;P&gt;Column:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max Oty on backorder = MAXX(FILTER('Table',[SKU]=EARLIER('Table'[SKU])),[Qty on backorder])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Cumulative = CALCULATE(SUM('Table'[Qty ordered]),FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Index]&amp;lt;EARLIER('Table'[Index])))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Result = 
SWITCH(TRUE(),
 [Cumulative] = BLANK ()&amp;amp;&amp;amp; [Qty ordered] &amp;lt;= [Qty on backorder], [Qty ordered],
 [Cumulative] = BLANK ()&amp;amp;&amp;amp; [Qty ordered] &amp;gt; [Qty on backorder],[Qty on backorder],
 [Max Oty on backorder]-[Cumulative]&amp;lt;0,0,
 [Qty ordered]&amp;lt;[Cumulative],[Qty ordered],[Max Oty on backorder]-[Cumulative])&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Is this the result you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 07:53:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sum-based-on-other-columns/m-p/3030563#M103544</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2023-01-19T07:53:28Z</dc:date>
    </item>
  </channel>
</rss>

