<?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 Creating a measure filtering average sales for 12 month period prior to the last 12 Mos in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-filtering-average-sales-for-12-month-period/m-p/2513729#M69799</link>
    <description>&lt;P&gt;I currently have a measure (AvgSalesLast12Mos) which calculates average sales for the previous 12 month period.&amp;nbsp; The measure uses another measure called Avg Sales which is calculated by dividing Total Sales / Total Business Days.&amp;nbsp; The AvgSalesLast12Mos measure was created using DAX listed below.&amp;nbsp; I need to create another measure which calculates average sales for the 12 month period which preceeds the last 12 months used in AvgSalesLast12Mos.&amp;nbsp; Can I specify a different interval with the DATESINPERIOD command or do I have to use another method to calculate this new measure?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AvgSalesLast12Mos = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Avg Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATESINPERIOD&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[fulldatealternatekey]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[fulldatealternatekey]&lt;/SPAN&gt;&lt;SPAN&gt; ), -&lt;/SPAN&gt;&lt;SPAN&gt;13&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks,&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RACope&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 13 May 2022 14:11:41 GMT</pubDate>
    <dc:creator>racope</dc:creator>
    <dc:date>2022-05-13T14:11:41Z</dc:date>
    <item>
      <title>Creating a measure filtering average sales for 12 month period prior to the last 12 Mos</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-filtering-average-sales-for-12-month-period/m-p/2513729#M69799</link>
      <description>&lt;P&gt;I currently have a measure (AvgSalesLast12Mos) which calculates average sales for the previous 12 month period.&amp;nbsp; The measure uses another measure called Avg Sales which is calculated by dividing Total Sales / Total Business Days.&amp;nbsp; The AvgSalesLast12Mos measure was created using DAX listed below.&amp;nbsp; I need to create another measure which calculates average sales for the 12 month period which preceeds the last 12 months used in AvgSalesLast12Mos.&amp;nbsp; Can I specify a different interval with the DATESINPERIOD command or do I have to use another method to calculate this new measure?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AvgSalesLast12Mos = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Avg Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DATESINPERIOD&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[fulldatealternatekey]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;'Date'[fulldatealternatekey]&lt;/SPAN&gt;&lt;SPAN&gt; ), -&lt;/SPAN&gt;&lt;SPAN&gt;13&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks,&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RACope&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 May 2022 14:11:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-filtering-average-sales-for-12-month-period/m-p/2513729#M69799</guid>
      <dc:creator>racope</dc:creator>
      <dc:date>2022-05-13T14:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a measure filtering average sales for 12 month period prior to the last 12 Mos</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-filtering-average-sales-for-12-month-period/m-p/2514412#M69857</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;You can try:&lt;/P&gt;&lt;P&gt;result = CALCULATE([avg sales],PARALLELPERIOD('Dates'[Date],-1,YEAR))&amp;nbsp; ..you can change how many years back, this will give you a 12 month answer. I hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 19:16:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-filtering-average-sales-for-12-month-period/m-p/2514412#M69857</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-05-13T19:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a measure filtering average sales for 12 month period prior to the last 12 Mos</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-filtering-average-sales-for-12-month-period/m-p/2522245#M70390</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="340802" data-lia-user-login="racope" class="lia-mention lia-mention-user"&gt;racope&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try this Measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AvgForDatesInPast =
VAR minDate =
    CALCULATE (
        MIN ( 'Date'[fulldatealternatekey] ),
        DATESINPERIOD (
            'Date'[fulldatealternatekey],
            MAX ( 'Date'[fulldatealternatekey] ),
            -13,
            MONTH
        )
    ) - 1
RETURN
    CALCULATE (
        [avg sales],
        DATESINPERIOD ( 'Date'[fulldatealternatekey], minDate, -13, MONTH )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, the result should look like this.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, attach the pbix file as reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider&lt;STRONG&gt; Accept it as the solution&lt;/STRONG&gt; to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _ Caiyun&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 06:23:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-filtering-average-sales-for-12-month-period/m-p/2522245#M70390</guid>
      <dc:creator>v-cazheng-msft</dc:creator>
      <dc:date>2022-05-18T06:23:37Z</dc:date>
    </item>
  </channel>
</rss>

