<?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 Missing months from DAX expression for a Measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Missing-months-from-DAX-expression-for-a-Measure/m-p/3443469#M130870</link>
    <description>&lt;P&gt;I have written this DAX expression for a measure in order to find the 12 month rolling average starting from the most recent month to 12 months before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;12MonthRollingAvg =&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR numOfMonths=12&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR lastCurrentDate=MAX('Calendar_Month'[First Day of Month])&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR Period = DATESINPERIOD('Calendar_Month'[First Day of Month], lastCurrentDate,-numOfMonths,MONTH)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR result = CALCULATE(&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; AVERAGEX(&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VALUES('Calendar_Month'[Calendar Month - Name]), [Measure_2]),&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Period&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;Return&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;if ([Measure_2]&amp;gt;0 , result)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have data from 2018 to 2023 coming from an SSAS connection. The visualization with this measure is posted below:&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;This is the most recent month in the table i.e. September.&lt;BR /&gt;However the first month displays February whereas it should have been October i.e. October to September.&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I'm unsure as to why this is happening as the data is precise for all months from 2018-2023. Would appreciate any help.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 22 Sep 2023 15:55:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-09-22T15:55:58Z</dc:date>
    <item>
      <title>Missing months from DAX expression for a Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Missing-months-from-DAX-expression-for-a-Measure/m-p/3443469#M130870</link>
      <description>&lt;P&gt;I have written this DAX expression for a measure in order to find the 12 month rolling average starting from the most recent month to 12 months before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;12MonthRollingAvg =&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR numOfMonths=12&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR lastCurrentDate=MAX('Calendar_Month'[First Day of Month])&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR Period = DATESINPERIOD('Calendar_Month'[First Day of Month], lastCurrentDate,-numOfMonths,MONTH)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR result = CALCULATE(&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; AVERAGEX(&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; VALUES('Calendar_Month'[Calendar Month - Name]), [Measure_2]),&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Period&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;Return&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;if ([Measure_2]&amp;gt;0 , result)&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have data from 2018 to 2023 coming from an SSAS connection. The visualization with this measure is posted below:&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;This is the most recent month in the table i.e. September.&lt;BR /&gt;However the first month displays February whereas it should have been October i.e. October to September.&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I'm unsure as to why this is happening as the data is precise for all months from 2018-2023. Would appreciate any help.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 22 Sep 2023 15:55:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Missing-months-from-DAX-expression-for-a-Measure/m-p/3443469#M130870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-22T15:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Missing months from DAX expression for a Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Missing-months-from-DAX-expression-for-a-Measure/m-p/3444737#M131009</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;I would say your measure for Average do not include unique values for periods as in 12 months period there is "2 years" included, like 3 months from previous year and 9 months in this year. I mean, you should include your Calendar date, columns like YEAR-MONTH, not just month. Try it and debug.&lt;/P&gt;&lt;P&gt;Great link with example is below&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/" target="_self"&gt;https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this help. Cudos appreciated.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 13:49:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Missing-months-from-DAX-expression-for-a-Measure/m-p/3444737#M131009</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2023-09-24T13:49:58Z</dc:date>
    </item>
  </channel>
</rss>

