<?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: calculate running sales for previous years in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-running-sales-for-previous-years/m-p/3364707#M126509</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;It is for creating a new column.&lt;BR /&gt;I hope the below can provide some ideas on how to create a solution for your datamodel.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Prev Year Contract Amount CC =
SUMX (
    WINDOW (
        1,
        ABS,
        -1,
        REL,
        GROUPBY (
            Data,
            Data[Year],
            Data[Customer],
            "@amountsum", SUMX ( CURRENTGROUP (), Data[Contract Amount] )
        ),
        ORDERBY ( Data[Year] ),
        ,
        PARTITIONBY ( Data[Customer] )
    ),
    [@amountsum]
)
&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 04 Aug 2023 03:39:52 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2023-08-04T03:39:52Z</dc:date>
    <item>
      <title>calculate running sales for previous years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-running-sales-for-previous-years/m-p/3364220#M126490</link>
      <description>&lt;P&gt;Hi , I am looking for help to calculate&amp;nbsp;calculate running/rolling sum sales for &lt;STRONG&gt;Previous years&amp;nbsp;Contract Amt.&lt;/STRONG&gt;&lt;BR /&gt;Year | Month | CustomerGroup| Customer | Contract | &lt;STRONG&gt;Contract Amt | Previous years&amp;nbsp;Contract Amt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2020&amp;nbsp; 11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Smith&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S12345&amp;nbsp; &amp;nbsp; &amp;nbsp; $100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2021&amp;nbsp; 12&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Smith&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S12345&amp;nbsp; &amp;nbsp; &amp;nbsp; $200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt; $100&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2022&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Smith&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S12345&amp;nbsp; &amp;nbsp; &amp;nbsp; $90&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;$300&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2022&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Smith&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;S12345&amp;nbsp; &amp;nbsp; &amp;nbsp; $120&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;$300&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;2023 ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this, but this returns&amp;nbsp;&lt;STRONG&gt;Contract Amt &lt;/STRONG&gt;for ALL Customers&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Previous years&amp;nbsp;Contract Amt&lt;/STRONG&gt; = CALCULATE (&lt;BR /&gt;SUM ( Table[Contract Amt] ),&lt;BR /&gt;ALL(Table) ,Table[Year] &amp;lt; EARLIER( Table[Year]&lt;BR /&gt;))&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 19:11:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-running-sales-for-previous-years/m-p/3364220#M126490</guid>
      <dc:creator>Julia1234</dc:creator>
      <dc:date>2023-08-03T19:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: calculate running sales for previous years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-running-sales-for-previous-years/m-p/3364707#M126509</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&lt;/P&gt;
&lt;P&gt;It is for creating a new column.&lt;BR /&gt;I hope the below can provide some ideas on how to create a solution for your datamodel.&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Prev Year Contract Amount CC =
SUMX (
    WINDOW (
        1,
        ABS,
        -1,
        REL,
        GROUPBY (
            Data,
            Data[Year],
            Data[Customer],
            "@amountsum", SUMX ( CURRENTGROUP (), Data[Contract Amount] )
        ),
        ORDERBY ( Data[Year] ),
        ,
        PARTITIONBY ( Data[Customer] )
    ),
    [@amountsum]
)
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Aug 2023 03:39:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-running-sales-for-previous-years/m-p/3364707#M126509</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2023-08-04T03:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: calculate running sales for previous years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-running-sales-for-previous-years/m-p/3372833#M126958</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="225330" data-lia-user-login="JihwanKim" class="lia-mention lia-mention-user"&gt;JihwanKim&lt;/a&gt;&amp;nbsp;, this is very helpful, I was looking for exactly this - dax window function.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 18:55:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-running-sales-for-previous-years/m-p/3372833#M126958</guid>
      <dc:creator>Julia1234</dc:creator>
      <dc:date>2023-08-09T18:55:38Z</dc:date>
    </item>
  </channel>
</rss>

