<?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: Reverse Cummulative Sum in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1748211#M36364</link>
    <description>&lt;P&gt;Hello&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can use this measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CummulativeQty = 
var currentId = SELECTEDVALUE('Table'[id])
var currentWH = SELECTEDVALUE('Table'[WH])
var currentCode = SELECTEDVALUE('Table'[Code])
var currentYear = SELECTEDVALUE('Table'[Year])
var currentMonth = SELECTEDVALUE('Table'[Month])
RETURN
CALCULATE(
    SUM('Table'[Qty]),
    FILTER(
        ALL('Table'),
        'Table'[id] = currentId &amp;amp;&amp;amp;
        'Table'[WH] = currentWH &amp;amp;&amp;amp;
        'Table'[Code] = currentCode &amp;amp;&amp;amp;
        'Table'[Year] = currentYear &amp;amp;&amp;amp;
        currentMonth &amp;lt;= 'Table'[Month]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#999999"&gt;Did I answer your question? Mark my post as a solution!&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Mar 2021 13:19:03 GMT</pubDate>
    <dc:creator>ERD</dc:creator>
    <dc:date>2021-03-26T13:19:03Z</dc:date>
    <item>
      <title>Reverse Cummulative Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1746370#M36318</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help with creating a column/measure in Power BI Desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a reverse cumulative sum based on multiple columns below is the dataset(example):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last column is the result I want (cumm_qty):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;for the combination: "20-DL-1051001002-2021" (has three rows for one for each month )&lt;/P&gt;&lt;P&gt;now I want a "cumm_qty" in reverse order i.e for 3rd month the value is &lt;STRONG&gt;-30495&lt;/STRONG&gt;, for 2nd month it's &lt;STRONG&gt;30495&lt;/STRONG&gt;, for third month its&amp;nbsp; &lt;STRONG&gt;19000&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for 3rd month the value should be same (-30495), for 2nd month the value should be (-30495+30495 = 0), for 1st month it should be (-30495+30495+19000 = 19000).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So If I add one more month then the calculation should be:&lt;/P&gt;&lt;P&gt;4th month = 4th month qty&lt;/P&gt;&lt;P&gt;3rd month = 4th month qty + 3rd month qty&lt;/P&gt;&lt;P&gt;2nd month = 4th month qty + 3rd month qty +&amp;nbsp;&amp;nbsp;2nd month qty&lt;/P&gt;&lt;P&gt;1st month = 4th month qty + 3rd month qty +&amp;nbsp;&amp;nbsp;2nd month qty + 1st month qty&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;&lt;P&gt;Please help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shubham&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 18:16:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1746370#M36318</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-25T18:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse Cummulative Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1748211#M36364</link>
      <description>&lt;P&gt;Hello&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can use this measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CummulativeQty = 
var currentId = SELECTEDVALUE('Table'[id])
var currentWH = SELECTEDVALUE('Table'[WH])
var currentCode = SELECTEDVALUE('Table'[Code])
var currentYear = SELECTEDVALUE('Table'[Year])
var currentMonth = SELECTEDVALUE('Table'[Month])
RETURN
CALCULATE(
    SUM('Table'[Qty]),
    FILTER(
        ALL('Table'),
        'Table'[id] = currentId &amp;amp;&amp;amp;
        'Table'[WH] = currentWH &amp;amp;&amp;amp;
        'Table'[Code] = currentCode &amp;amp;&amp;amp;
        'Table'[Year] = currentYear &amp;amp;&amp;amp;
        currentMonth &amp;lt;= 'Table'[Month]
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#999999"&gt;Did I answer your question? Mark my post as a solution!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 13:19:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1748211#M36364</guid>
      <dc:creator>ERD</dc:creator>
      <dc:date>2021-03-26T13:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse Cummulative Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1749342#M36413</link>
      <description>&lt;P&gt;or calculated column with similar formula.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=CALCULATE(SUM(Table1[qty]),
	filter(Table1,
	Table1[id]=EARLIER(Table1[id]) &amp;amp;&amp;amp; 
	Table1[wh]=EARLIER(Table1[wh]) &amp;amp;&amp;amp; 
	Table1[code]=EARLIER(Table1[code]) &amp;amp;&amp;amp; 
	Table1[year]=EARLIER(Table1[year]) &amp;amp;&amp;amp; 
	Table1[month]&amp;gt;=EARLIER(Table1[month])
	))&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 27 Mar 2021 09:24:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1749342#M36413</guid>
      <dc:creator>rfigtree</dc:creator>
      <dc:date>2021-03-27T09:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reverse Cummulative Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1750217#M36461</link>
      <description>&lt;P&gt;Small question for VAR and SELECTEDVALUE&lt;BR /&gt;if selected ALL in a filter, i got Blank() as result (in var), how can i solve the problem in Calculate?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 18:56:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Reverse-Cummulative-Sum/m-p/1750217#M36461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-28T18:56:51Z</dc:date>
    </item>
  </channel>
</rss>

