<?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 Average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1891956#M40752</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;Good afternoon.

How do I calculate the average purchase of the past months to customer, starting from the selected month?

example.

I selected june/2021 he would make the average of may, april, march, february and january of that same year.

 

Thank you in advance.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jun 2021 01:04:56 GMT</pubDate>
    <dc:creator>SLima</dc:creator>
    <dc:date>2021-06-10T01:04:56Z</dc:date>
    <item>
      <title>Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1891956#M40752</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="Y2IQFc"&gt;Good afternoon.

How do I calculate the average purchase of the past months to customer, starting from the selected month?

example.

I selected june/2021 he would make the average of may, april, march, february and january of that same year.

 

Thank you in advance.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 01:04:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1891956#M40752</guid>
      <dc:creator>SLima</dc:creator>
      <dc:date>2021-06-10T01:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1892245#M40756</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="287457" data-lia-user-login="SLima" class="lia-mention lia-mention-user"&gt;SLima&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you have a Date table set up with a YearMonth column (or similar), something along these lines should do the trick:&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;Average Purchases over 5 preceding months = 
CALCULATE ( 
    AVERAGEX ( 
        VALUES ( 'Date'[YearMonth] ),
        [Purchases]
    ),
    DATESINPERIOD (
        'Date'[Date],
        EOMONTH ( MAX ( 'Date'[Date] ), -1 ),
        -5,
        MONTH
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jun 2021 00:40:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1892245#M40756</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2021-06-12T00:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1896271#M40861</link>
      <description>&lt;P&gt;&lt;SPAN&gt;it would not be the previous 5 months, it would be from the selected month/year&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 15:12:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1896271#M40861</guid>
      <dc:creator>SLima</dc:creator>
      <dc:date>2021-06-11T15:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1896750#M40878</link>
      <description>&lt;P&gt;Yes, in the code above, the maximum visible date is used as the reference point for determining the date filter for the "previous" 5 months.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can change &lt;STRONG&gt;MAX ( 'Date'[Date] )&lt;/STRONG&gt; to &lt;STRONG&gt;TODAY()&lt;/STRONG&gt; for the date filter to be determined relative to the current date (when the query is generated from the report page):&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;Average Purchases over 5 preceding months =
CALCULATE (
    AVERAGEX (
        VALUES ( 'Date'[YearMonth] ),
        [Purchases]
    ),
    DATESINPERIOD (
        'Date'[Date],
        EOMONTH ( TODAY (), -1 ),
        -5,
        MONTH
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jun 2021 00:41:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1896750#M40878</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2021-06-12T00:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1897100#M40892</link>
      <description>&lt;P&gt;I did it that way&lt;/P&gt;&lt;P&gt;Sales Average last months =&amp;nbsp;&lt;BR /&gt;CALCULATE (&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; AVERAGEX (&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VALUES ( dCalendario[MonthYear] ),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Sales]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; DATESINPERIOD (&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ( dCalendario[date]),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EOMONTH ( MAX ( dCalendario[date] ), -1 ),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SWITCH(VALUES(dCalendario[MonthNum]),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12,-11,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11,-10,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10,-9,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9,-8,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8,-7,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7,-6,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6,-5,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5,-4,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4,-3,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3,-2,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2,-1),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MONTH&lt;BR /&gt;&amp;nbsp; &amp;nbsp; )&lt;BR /&gt;)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jun 2021 16:09:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average/m-p/1897100#M40892</guid>
      <dc:creator>SLima</dc:creator>
      <dc:date>2021-06-12T16:09:00Z</dc:date>
    </item>
  </channel>
</rss>

