<?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: Grand Total Sum of Last Year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Grand-Total-Sum-of-Last-Year/m-p/2703399#M81895</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="427247" data-lia-user-login="RookiePowerBI19" class="lia-mention lia-mention-user"&gt;RookiePowerBI19&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;// Base measure
[Total KG] = SUM( 'Sales'[KG] )

// Derivative
[Total KG LY] = // last year's KG
    SUMX(
        DISTINCT( 'Sales'[Period] ),
        var IteratedPeriod = 'Sales'[Period]
        var KGLastYear = 
            CALCULATE(
                [Total KG],
                'Sales'[Period] = IteratedPeriod - 100
            )
        return
            KGLastYear
    )&lt;/LI-CODE&gt;
&lt;P&gt;Event though the above works, I would kindly warn you that this model should be changed asap as it's not correct. For correct models please consult this article:&amp;nbsp;&lt;A href="https://www.bing.com/ck/a?!&amp;amp;&amp;amp;p=f99e06128ddffbb0JmltdHM9MTY2MDY1ODEzNyZpZ3VpZD1iN2Y0NDE0NC1kMWNmLTQ0NDAtOTdjYi1mMzgxMDg3YzVjNzEmaW5zaWQ9NTE4Nw&amp;amp;ptn=3&amp;amp;hsh=3&amp;amp;fclid=1b31fd4d-1d6b-11ed-a19d-3400d1938320&amp;amp;u=a1aHR0cHM6Ly9kb2NzLm1pY3Jvc29mdC5jb20vZW4tdXMvcG93ZXItYmkvZ3VpZGFuY2Uvc3Rhci1zY2hlbWE&amp;amp;ntb=1" target="_blank"&gt;Understand star schema and the importance for Power BI … (bing.com)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2022 13:55:47 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-08-16T13:55:47Z</dc:date>
    <item>
      <title>Grand Total Sum of Last Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Grand-Total-Sum-of-Last-Year/m-p/2703370#M81892</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need some basic assistance for an easy DAX command. Assume I have a table with 2 columns&lt;/P&gt;&lt;P&gt;'Sales'[Period] - Year and Month combined (202001, 202002 etc).&lt;/P&gt;&lt;P&gt;'Sales'[KG] - Numerical values in KG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now assume I want to have a pivot table with Periods between 202201 and 202212 where I present the sales in KG for those periods but also last years sales ('Sales'[Period]-100). The difference between this year and last year in that column is 100 for each value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried&lt;/P&gt;&lt;P&gt;Calculate(&lt;/P&gt;&lt;P&gt;SUM('Sales'[KG],&lt;/P&gt;&lt;P&gt;FILTER(&lt;/P&gt;&lt;P&gt;ALL['Sales'[Period]),&lt;/P&gt;&lt;P&gt;'Sales'[Period]=MAX('Sales'[Period])-100&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works great for all the individual Periods but not in the Grand Total. The Grand Total only shows the sum for the last individual value (202212).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help out here?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 13:47:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Grand-Total-Sum-of-Last-Year/m-p/2703370#M81892</guid>
      <dc:creator>RookiePowerBI19</dc:creator>
      <dc:date>2022-08-16T13:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Grand Total Sum of Last Year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Grand-Total-Sum-of-Last-Year/m-p/2703399#M81895</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="427247" data-lia-user-login="RookiePowerBI19" class="lia-mention lia-mention-user"&gt;RookiePowerBI19&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;// Base measure
[Total KG] = SUM( 'Sales'[KG] )

// Derivative
[Total KG LY] = // last year's KG
    SUMX(
        DISTINCT( 'Sales'[Period] ),
        var IteratedPeriod = 'Sales'[Period]
        var KGLastYear = 
            CALCULATE(
                [Total KG],
                'Sales'[Period] = IteratedPeriod - 100
            )
        return
            KGLastYear
    )&lt;/LI-CODE&gt;
&lt;P&gt;Event though the above works, I would kindly warn you that this model should be changed asap as it's not correct. For correct models please consult this article:&amp;nbsp;&lt;A href="https://www.bing.com/ck/a?!&amp;amp;&amp;amp;p=f99e06128ddffbb0JmltdHM9MTY2MDY1ODEzNyZpZ3VpZD1iN2Y0NDE0NC1kMWNmLTQ0NDAtOTdjYi1mMzgxMDg3YzVjNzEmaW5zaWQ9NTE4Nw&amp;amp;ptn=3&amp;amp;hsh=3&amp;amp;fclid=1b31fd4d-1d6b-11ed-a19d-3400d1938320&amp;amp;u=a1aHR0cHM6Ly9kb2NzLm1pY3Jvc29mdC5jb20vZW4tdXMvcG93ZXItYmkvZ3VpZGFuY2Uvc3Rhci1zY2hlbWE&amp;amp;ntb=1" target="_blank"&gt;Understand star schema and the importance for Power BI … (bing.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2022 13:55:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Grand-Total-Sum-of-Last-Year/m-p/2703399#M81895</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-08-16T13:55:47Z</dc:date>
    </item>
  </channel>
</rss>

