<?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 Optimizing a simple moving average measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2823551#M89697</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Invoice Fact table with about 300,000 roles , 4 Dimension tables and a Date table with one to many relationships. I am trying to create a simple table with Invoice # and a column from each dimesion table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works fine until i add my measure below. Is there a way to optimize this measure?&amp;nbsp; It seem so simple that I shouldn't have this issue but I know DAX is complex and am hoping there is an obvious solution I am overlooking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revenue 12MM =&lt;BR /&gt;VAR revenue12mm = CALCULATE([SUM( Invoice[Revenue] ),&lt;BR /&gt;REMOVEFILTERS(Dates[Date]),&lt;BR /&gt;DATESINPERIOD(Dates[Date], LASTDATE(Invoice[ReportingDate]), -12, MONTH)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF( revenue12mm = 0, BLANK(), revenue12mm)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2022 17:11:56 GMT</pubDate>
    <dc:creator>nbs33</dc:creator>
    <dc:date>2022-10-06T17:11:56Z</dc:date>
    <item>
      <title>Optimizing a simple moving average measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2823551#M89697</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Invoice Fact table with about 300,000 roles , 4 Dimension tables and a Date table with one to many relationships. I am trying to create a simple table with Invoice # and a column from each dimesion table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works fine until i add my measure below. Is there a way to optimize this measure?&amp;nbsp; It seem so simple that I shouldn't have this issue but I know DAX is complex and am hoping there is an obvious solution I am overlooking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revenue 12MM =&lt;BR /&gt;VAR revenue12mm = CALCULATE([SUM( Invoice[Revenue] ),&lt;BR /&gt;REMOVEFILTERS(Dates[Date]),&lt;BR /&gt;DATESINPERIOD(Dates[Date], LASTDATE(Invoice[ReportingDate]), -12, MONTH)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;IF( revenue12mm = 0, BLANK(), revenue12mm)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 17:11:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2823551#M89697</guid>
      <dc:creator>nbs33</dc:creator>
      <dc:date>2022-10-06T17:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing a simple moving average measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2823584#M89700</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315872" data-lia-user-login="nbs33" class="lia-mention lia-mention-user"&gt;nbs33&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try to replace LASTDATE with MAX&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 17:33:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2823584#M89700</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-10-06T17:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing a simple moving average measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2823678#M89705</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;thanks for the help. It didn't work. Could it be realted to DATESINPERIOD?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 18:28:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2823678#M89705</guid>
      <dc:creator>nbs33</dc:creator>
      <dc:date>2022-10-06T18:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing a simple moving average measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2825355#M89815</link>
      <description>&lt;P&gt;Hi &amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315872" data-lia-user-login="nbs33" class="lia-mention lia-mention-user"&gt;nbs33&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, you want to calculate the previous year's revenue , right?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try to create a measure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Revenue 12MM =

VAR revenue12mm = CALCULATE(SUM(Invoice[Revenue]), PARALLELPERIOD(Dates[Date],-1,year))  

RETURN

IF( revenue12mm = 0, BLANK(), revenue12mm)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more information about the function you can refer to the following documents.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/parallelperiod-function-dax" target="_blank"&gt;PARALLELPERIOD function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 09:49:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2825355#M89815</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-07T09:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing a simple moving average measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2855346#M91751</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="315872" data-lia-user-login="nbs33" class="lia-mention lia-mention-user"&gt;nbs33&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Has your problem been solved?If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 08:59:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2855346#M91751</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-10-21T08:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Optimizing a simple moving average measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2883725#M93423</link>
      <description>&lt;P&gt;After a lot of trial and error and looking at the query analizer I relized most of the time was spent joining the dimension tables to the fact table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To overcome this I colapsed the necessary columns of my demnsion table into may fact table and this greatly improved performance.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 19:11:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Optimizing-a-simple-moving-average-measure/m-p/2883725#M93423</guid>
      <dc:creator>nbs33</dc:creator>
      <dc:date>2022-11-03T19:11:00Z</dc:date>
    </item>
  </channel>
</rss>

