<?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: Measure for average in a time period also returning a value for dates outside the time period in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-for-average-in-a-time-period-also-returning-a-value-for/m-p/2148143#M49458</link>
    <description>&lt;P&gt;Replacing my "12-Month Average Files Opened" Measure with this formula caused my "12m Average 12 motnhs prior to the selected month" measure to start working!&lt;BR /&gt;Still don't know why, but thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 21 Oct 2021 12:48:37 GMT</pubDate>
    <dc:creator>dblair</dc:creator>
    <dc:date>2021-10-21T12:48:37Z</dc:date>
    <item>
      <title>Measure for average in a time period also returning a value for dates outside the time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-for-average-in-a-time-period-also-returning-a-value-for/m-p/2140855#M49210</link>
      <description>&lt;P&gt;This is driving me&amp;nbsp; little crazy - I'm trying to measure a rolling average only in a period 12 months prior to a given date.&lt;/P&gt;&lt;P&gt;I'm getting the correct values for the correct months, but for some reason it's also returning some odd value (an average over the whole selected period?) for all other months as well.&lt;/P&gt;&lt;P&gt;I copied this pretty closely from another measure (12-week rolling average of [measure] for 12 weeks prior to selected date), and that one&amp;nbsp; returns blanks for any dates outside the period. I've compared them closely, but I have no idea why they behave differently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;12-Month Average Files Opened = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;DIVIDE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;[Files Opened], &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;DISTINCTCOUNT('Calendar'[CurMonthOffset]), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;BLANK()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;FILTER(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;ALL('Calendar'), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;'Calendar'[CurMonthOffset] &amp;gt;= max('Calendar'[CurMonthOffset])-12 &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;&amp;amp;&amp;amp; 'Calendar'[CurMonthOffset] &amp;lt;= max('Calendar'[CurMonthOffset])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;12m Average Files Opened 12m prior to selection = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;[12-Month Average Files Opened], &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;FILTER(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;'Calendar', &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;'Calendar'[CurMonthOffset] &amp;lt;= [Selected Month] &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;&amp;amp;&amp;amp; 'Calendar'[CurMonthOffset] &amp;gt;= [Selected Month] - 12&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-90px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;And here's a screenshot of the values:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="lia-indent-padding-left-60px"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Oct 2021 13:59:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-for-average-in-a-time-period-also-returning-a-value-for/m-p/2140855#M49210</guid>
      <dc:creator>dblair</dc:creator>
      <dc:date>2021-10-18T13:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Measure for average in a time period also returning a value for dates outside the time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-for-average-in-a-time-period-also-returning-a-value-for/m-p/2147552#M49443</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="272782" data-lia-user-login="dblair" class="lia-mention lia-mention-user"&gt;dblair&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have tried something like below?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;12m Average Files Opened 12m prior to selection =
VAR FilesOpened_Sum_ =
    CALCULATE (
        [Files Opened],
        DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), - 12, MONTH )
    )
RETURN
    DIVIDE ( FilesOpened_Sum_, 12 )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reference:&amp;nbsp;&lt;A href="http://sqljason.com/2018/03/display-last-n-months-selected-month-using-single-date-dimension-in-power-bi.html" target="_blank"&gt;Display Last N Months &amp;amp; Selected Month using Single Date Dimension in Power BI – Some Random Thoughts (sqljason.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Icey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;SPAN&gt;, then please consider&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 08:11:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-for-average-in-a-time-period-also-returning-a-value-for/m-p/2147552#M49443</guid>
      <dc:creator>Icey</dc:creator>
      <dc:date>2021-10-21T08:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Measure for average in a time period also returning a value for dates outside the time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-for-average-in-a-time-period-also-returning-a-value-for/m-p/2148143#M49458</link>
      <description>&lt;P&gt;Replacing my "12-Month Average Files Opened" Measure with this formula caused my "12m Average 12 motnhs prior to the selected month" measure to start working!&lt;BR /&gt;Still don't know why, but thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 12:48:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-for-average-in-a-time-period-also-returning-a-value-for/m-p/2148143#M49458</guid>
      <dc:creator>dblair</dc:creator>
      <dc:date>2021-10-21T12:48:37Z</dc:date>
    </item>
  </channel>
</rss>

