<?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 How to achieve a rolling prior 12M average? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2944906#M97379</link>
    <description>&lt;P&gt;I'm trying to create a Line and clustered column chart by month that returns four values using something like the sample data below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 1: Count of Account Type A Closed ** currently using Measure:&amp;nbsp;&lt;SPAN&gt;Cnt of Account Type A Closed = &lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;[Account Type]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"A"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 2: Count of Acount Type B Closed&amp;nbsp; ** Currently Using Measure:&amp;nbsp;&lt;SPAN&gt;Cnt of Account Type B Closed = &lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;[Account Type]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"B"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Line 1: Average of Prior 12M Account Type A Closed Per Month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Line 2: Average of Prior 12M Account Type B Closed Per Month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This visual needs to show only the last 12 months and the way I am achieving that with the two columns I have figured out is I am using the [Account Closed] and created month bins for the x axis and then applied a relative date filter to the visual for the last 365 days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I am really stuck on how to create something that would show Line 1 &amp;amp; 2 as I described above because in my current chart those lines would have to show the average of Dec 2021 - Dec 2022 for the month of December, the average of Jan 2021 - Jan 2022 for the month of January and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I am also wondering, is there even a way to do that since I have applied the relative date filter to my visual or will I also have to change the measures I am using to get my two columns?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help greatly appreciated!&amp;nbsp;&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;</description>
    <pubDate>Fri, 02 Dec 2022 14:51:44 GMT</pubDate>
    <dc:creator>OhLookAnError</dc:creator>
    <dc:date>2022-12-02T14:51:44Z</dc:date>
    <item>
      <title>How to achieve a rolling prior 12M average?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2944906#M97379</link>
      <description>&lt;P&gt;I'm trying to create a Line and clustered column chart by month that returns four values using something like the sample data below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 1: Count of Account Type A Closed ** currently using Measure:&amp;nbsp;&lt;SPAN&gt;Cnt of Account Type A Closed = &lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;[Account Type]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"A"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Column 2: Count of Acount Type B Closed&amp;nbsp; ** Currently Using Measure:&amp;nbsp;&lt;SPAN&gt;Cnt of Account Type B Closed = &lt;/SPAN&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;tblAccounts&lt;/SPAN&gt;&lt;SPAN&gt;[Account Type]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"B"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Line 1: Average of Prior 12M Account Type A Closed Per Month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Line 2: Average of Prior 12M Account Type B Closed Per Month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This visual needs to show only the last 12 months and the way I am achieving that with the two columns I have figured out is I am using the [Account Closed] and created month bins for the x axis and then applied a relative date filter to the visual for the last 365 days.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I am really stuck on how to create something that would show Line 1 &amp;amp; 2 as I described above because in my current chart those lines would have to show the average of Dec 2021 - Dec 2022 for the month of December, the average of Jan 2021 - Jan 2022 for the month of January and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I am also wondering, is there even a way to do that since I have applied the relative date filter to my visual or will I also have to change the measures I am using to get my two columns?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help greatly appreciated!&amp;nbsp;&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;</description>
      <pubDate>Fri, 02 Dec 2022 14:51:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2944906#M97379</guid>
      <dc:creator>OhLookAnError</dc:creator>
      <dc:date>2022-12-02T14:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve a rolling prior 12M average?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2944940#M97387</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="471693" data-lia-user-login="OhLookAnError" class="lia-mention lia-mention-user"&gt;OhLookAnError&lt;/a&gt;&amp;nbsp;See if this helps:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Better-Rolling-Average/m-p/2897874#M911" target="_blank"&gt;Better Rolling Average - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 15:12:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2944940#M97387</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-12-02T15:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve a rolling prior 12M average?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2947176#M97552</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="471693" data-lia-user-login="OhLookAnError" class="lia-mention lia-mention-user"&gt;OhLookAnError&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, you want to "&lt;SPAN&gt;achieve a rolling prior 12M average&lt;/SPAN&gt;".&lt;/P&gt;
&lt;P&gt;Here are the steps you can refer to:&lt;BR /&gt;(1)This is my test data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;(2)We can create two measures:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average of Prior 12M Account Type A Closed Per Month = 
var _count=COUNTROWS(FILTER(ALL('Table'),'Table'[Account Type]="A"&amp;amp;&amp;amp;[Account Closed]&amp;lt;&amp;gt;BLANK()&amp;amp;&amp;amp;[Account Closed]&amp;gt;=EOMONTH(MAX('Table'[Account Closed]),-13)+1&amp;amp;&amp;amp;[Account Closed]&amp;lt;EOMONTH(MAX('Table'[Account Closed]),-1)+1))
return
DIVIDE(_count,12)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Average of Prior 12M Account Type B Closed Per Month = 
var _count=COUNTROWS(FILTER(ALL('Table'),'Table'[Account Type]="B"&amp;amp;&amp;amp;[Account Closed]&amp;lt;&amp;gt;BLANK()&amp;amp;&amp;amp;[Account Closed]&amp;gt;=EOMONTH(MAX('Table'[Account Closed]),-13)+1&amp;amp;&amp;amp;[Account Closed]&amp;lt;=EOMONTH(MAX('Table'[Account Closed]),-1)+1))
return
DIVIDE(_count,12)&lt;/LI-CODE&gt;
&lt;P&gt;(3)Then we put the fields we need on the visual and we can meet your need:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If this method does not meet your needs, you can provide us with your special &lt;STRONG&gt;sample data&lt;/STRONG&gt; and the &lt;STRONG&gt;desired output sample&lt;/STRONG&gt; data in the form of &lt;STRONG&gt;tables&lt;/STRONG&gt;, so that we can better help you solve the problem.&lt;/P&gt;
&lt;P&gt;Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Aniya Zhang&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt; it as the solution&lt;/EM&gt;&amp;nbsp;to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 03:27:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2947176#M97552</guid>
      <dc:creator>v-yueyunzh-msft</dc:creator>
      <dc:date>2022-12-05T03:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve a rolling prior 12M average?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2973981#M99512</link>
      <description>&lt;P&gt;This is great, thanks so much for the help!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 18:32:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2973981#M99512</guid>
      <dc:creator>OhLookAnError</dc:creator>
      <dc:date>2022-12-16T18:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to achieve a rolling prior 12M average?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2974036#M99514</link>
      <description>&lt;P&gt;Is it possible to modify this to make a third measure to include both Account Types?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Trailing Average = VAR _COUNT=COUNTROWS(&amp;nbsp;Filter(ALL(tblAccounts), tblAccounts[Account Type] = "A" || "B" &amp;amp;&amp;amp; [Account Closed] &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; [Account Closed] &amp;gt;= EOMONTH(MAX(tblAccounts[Account Closed]),-13) +1&amp;amp;&amp;amp;[Account Closed] &amp;lt;EOMONTH(MAX(tblAccounts[Account Closed]),1)+1)) Return DIVIDE(_COUNT,12)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;Trailing Average = VAR _COUNT=COUNTROWS(&amp;nbsp;Filter(ALL(tblAccounts), [Account Closed] &amp;lt;&amp;gt; BLANK() &amp;amp;&amp;amp; [Account Closed] &amp;gt;= EOMONTH(MAX(tblAccounts[Account Closed]),-13) +1&amp;amp;&amp;amp;[Account Closed] &amp;lt;EOMONTH(MAX(tblAccounts[Account Closed]),1)+1)) Return DIVIDE(_COUNT,12)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;but neither would return a value. Thanks in advance!&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Dec 2022 19:19:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-achieve-a-rolling-prior-12M-average/m-p/2974036#M99514</guid>
      <dc:creator>OhLookAnError</dc:creator>
      <dc:date>2022-12-16T19:19:12Z</dc:date>
    </item>
  </channel>
</rss>

