<?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: Cumulative sales in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4103568#M162835</link>
    <description>&lt;P&gt;Hi All&lt;BR /&gt;Fisrtly Irwan&amp;nbsp;&amp;nbsp;thank you for your solution!&lt;BR /&gt;And&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="751853" data-lia-user-login="heetu24" class="lia-mention lia-mention-user"&gt;heetu24&lt;/a&gt;,&amp;nbsp;We just need to make a slight change in Irwan's DAX, and the filtering of YEARS with the selectedvalue function can be done to accumulate different years.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR A=SELECTEDVALUE('data'[Year])
VAR C=MAX(data[Index])
VAR B=CALCULATE(
    SUM('data'[Sales Value]),FILTER(ALL('data'),
   'data'[Year]=A&amp;amp;&amp;amp;'data'[Index]&amp;lt;=C)
    )
    RETURN
    IF(
        MAX('data'[Index])=1,
        0,
        B)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you have any other questions, check out the pbix file I uploaded, I hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Tom Shen&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Aug 2024 05:21:53 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-08-16T05:21:53Z</dc:date>
    <item>
      <title>Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4098397#M162626</link>
      <description>&lt;P&gt;Hello, All I am stuck in one scenario.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scenario: As per below screens shot. There is filter of Period and Year in Green color. In Power BI Period and Year are slicers.&lt;BR /&gt;&lt;BR /&gt;In Year column records are&amp;nbsp; : (TY:-This Year), (YA:-Year Ago), &amp;amp; (2YA: 2 Year ago)&lt;/P&gt;&lt;P&gt;In Period column records are : MAT, YTD&amp;nbsp; &amp;amp; QTR.&lt;BR /&gt;&lt;BR /&gt;I want to calculate Cumulative sales for "MAT" Period only and and each year such as TY, YA and 2 YA.&lt;BR /&gt;&lt;BR /&gt;Note: API: Average Price Index column is given in the table. so against API cumulative sales value will be there.&lt;BR /&gt;&amp;nbsp; Brand Name are same because imagine item level data so each brand represents&amp;nbsp; different item you can ignore why it is same Brand in this scenario.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above screen shot is in Excel. How to do in Power BI. I am beginner in DAX. Thank you to read my query &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 18:34:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4098397#M162626</guid>
      <dc:creator>heetu24</dc:creator>
      <dc:date>2024-08-13T18:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4098716#M162651</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="751853" data-lia-user-login="heetu24" class="lia-mention lia-mention-user"&gt;heetu24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please check if this accomodate your need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;since i dont see any order in that sample data, i assumed you have another column for sorting or indexing cummulative in that excel calculation. So i created another column for indexing from power query (this should be adjusted to your order column).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;create a new measure with following DAX&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;Cummulative &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _Index = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Index])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; _Sum =&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Sales Value]),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SP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DIV&gt;&lt;P&gt;both measure Cummulative 1 and Cummulative 2 have same result, but Cummulative 1 is using CALCULATE while Cummulative 2 is using SUMX. Choose either way should be fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2024 00:18:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4098716#M162651</guid>
      <dc:creator>Irwan</dc:creator>
      <dc:date>2024-08-14T00:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4101791#M162761</link>
      <description>&lt;P&gt;Hi Thank you for this solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I mentioned in screen shot. I am looking cumulative for year&amp;nbsp; wise that you provided cumulative for TY and same for YA and 2 YA .&lt;/P&gt;&lt;P&gt;So if user select year select on TY/YA /2YA any of this so dynamically it can change cumulative sales. Is it possible to use summarize DAX function?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 07:29:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4101791#M162761</guid>
      <dc:creator>heetu24</dc:creator>
      <dc:date>2024-08-15T07:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Cumulative sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4103568#M162835</link>
      <description>&lt;P&gt;Hi All&lt;BR /&gt;Fisrtly Irwan&amp;nbsp;&amp;nbsp;thank you for your solution!&lt;BR /&gt;And&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="751853" data-lia-user-login="heetu24" class="lia-mention lia-mention-user"&gt;heetu24&lt;/a&gt;,&amp;nbsp;We just need to make a slight change in Irwan's DAX, and the filtering of YEARS with the selectedvalue function can be done to accumulate different years.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
VAR A=SELECTEDVALUE('data'[Year])
VAR C=MAX(data[Index])
VAR B=CALCULATE(
    SUM('data'[Sales Value]),FILTER(ALL('data'),
   'data'[Year]=A&amp;amp;&amp;amp;'data'[Index]&amp;lt;=C)
    )
    RETURN
    IF(
        MAX('data'[Index])=1,
        0,
        B)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you have any other questions, check out the pbix file I uploaded, I hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;BR /&gt;Community Support Team_ Tom Shen&lt;/P&gt;
&lt;P&gt;If this post helps then please consider&amp;nbsp;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 05:21:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Cumulative-sales/m-p/4103568#M162835</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-16T05:21:53Z</dc:date>
    </item>
  </channel>
</rss>

