<?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: DAX to fill in a quarter with an estimate if distinct months within a quarter &amp;lt;&amp;gt; 3 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-fill-in-a-quarter-with-an-estimate-if-distinct-months/m-p/4024467#M158861</link>
    <description>&lt;P&gt;Hi,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="769996" data-lia-user-login="Kaiden" class="lia-mention lia-mention-user"&gt;Kaiden&lt;/a&gt;&amp;nbsp; I am glad to help you.&lt;BR /&gt;You can refer to my test below&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;M_result = 
VAR _DATE=CALCULATE(MAX(Sheet2[Date]),FILTER(ALL(Sheet2),'Sheet2'[QuarterNum]=MAX('Sheet2'[QuarterNum])&amp;amp;&amp;amp;'Sheet2'[YearNum]=MAX('Sheet2'[YearNum])))
VAR _DATE_Two=EOMONTH(_DATE,-3)+1
 RETURN
 
 SWITCH(TRUE(),
[M_eachMonNum_Aquarter1] = 1,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]&amp;gt;=_DATE_Two&amp;amp;&amp;amp;Sheet2[Date]&amp;lt;=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 2,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]&amp;gt;=_DATE_Two&amp;amp;&amp;amp;Sheet2[Date]&amp;lt;=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 3,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]&amp;gt;=_DATE_Two&amp;amp;&amp;amp;Sheet2[Date]&amp;lt;=_DATE),Sheet2[Cost])/3
 )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate column&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YearNum = YEAR('Sheet2'[Date])


QuarterNum = QUARTER('Sheet2'[Date])


MonthNum = MONTH('Sheet2'[Date])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Carson Jian,&lt;/P&gt;
&lt;P&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solutio&lt;/STRONG&gt;&lt;/EM&gt;n to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jul 2024 07:34:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-07-04T07:34:02Z</dc:date>
    <item>
      <title>DAX to fill in a quarter with an estimate if distinct months within a quarter &lt;&gt; 3</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-fill-in-a-quarter-with-an-estimate-if-distinct-months/m-p/4022907#M158740</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Matrix that compares Quarter over Quarter numbers, as well as yearly quarters (Q2 2023 vs Q2 2024).&lt;/P&gt;&lt;P&gt;What I am needing is a Measure that fills in empty months within a quarter with the average value of the last 3 completed months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: I have April and May data for Q2, I need something that would fill in June with an "Estimate" that is the average of the last 3 months, in this case March, April, May.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would need this to be done for all out months.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my current DAX for calculating the Estimate which seems to be working, I just need help with the part of applying this in the right scenarios:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt; Month &lt;/SPAN&gt;&lt;SPAN&gt;Average&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;"Estimate" = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(Table1[Cost]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;DATEADD&lt;/SPAN&gt;&lt;SPAN&gt;(Table1[Date&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date],-&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt;,MONTH))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;/&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What I imagine the setup would be for what I am needing is:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;IF (DISTINCT Months IN Qtr = 0) THEN ~DAX for Average from last 3 months~&lt;BR /&gt;Applied to PARALLELPERIODS +1 &amp;amp; +2 &amp;amp; +3&lt;/P&gt;&lt;P&gt;IF (DISTINCT Months IN Qtr = 1) THEN ~DAX for Average from last 3 months~&lt;BR /&gt;Applied to PARALLELPERIODS +1 &amp;amp; +2&lt;/P&gt;&lt;P&gt;IF (DISTINCT Months IN Qtr = 2) THEN ~DAX for Average from last 3 months~&lt;BR /&gt;Applied to PARALLELPERIODS +1&lt;/P&gt;&lt;P&gt;IF (DISTINCT Months IN Qtr = 3) THEN Do Nothing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Jul 2024 12:46:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-fill-in-a-quarter-with-an-estimate-if-distinct-months/m-p/4022907#M158740</guid>
      <dc:creator>Kaiden</dc:creator>
      <dc:date>2024-07-03T12:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: DAX to fill in a quarter with an estimate if distinct months within a quarter &lt;&gt; 3</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-fill-in-a-quarter-with-an-estimate-if-distinct-months/m-p/4024467#M158861</link>
      <description>&lt;P&gt;Hi,&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="769996" data-lia-user-login="Kaiden" class="lia-mention lia-mention-user"&gt;Kaiden&lt;/a&gt;&amp;nbsp; I am glad to help you.&lt;BR /&gt;You can refer to my test below&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;M_result = 
VAR _DATE=CALCULATE(MAX(Sheet2[Date]),FILTER(ALL(Sheet2),'Sheet2'[QuarterNum]=MAX('Sheet2'[QuarterNum])&amp;amp;&amp;amp;'Sheet2'[YearNum]=MAX('Sheet2'[YearNum])))
VAR _DATE_Two=EOMONTH(_DATE,-3)+1
 RETURN
 
 SWITCH(TRUE(),
[M_eachMonNum_Aquarter1] = 1,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]&amp;gt;=_DATE_Two&amp;amp;&amp;amp;Sheet2[Date]&amp;lt;=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 2,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]&amp;gt;=_DATE_Two&amp;amp;&amp;amp;Sheet2[Date]&amp;lt;=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 3,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]&amp;gt;=_DATE_Two&amp;amp;&amp;amp;Sheet2[Date]&amp;lt;=_DATE),Sheet2[Cost])/3
 )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;calculate column&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;YearNum = YEAR('Sheet2'[Date])


QuarterNum = QUARTER('Sheet2'[Date])


MonthNum = MONTH('Sheet2'[Date])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Carson Jian,&lt;/P&gt;
&lt;P&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solutio&lt;/STRONG&gt;&lt;/EM&gt;n to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2024 07:34:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-to-fill-in-a-quarter-with-an-estimate-if-distinct-months/m-p/4024467#M158861</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-04T07:34:02Z</dc:date>
    </item>
  </channel>
</rss>

