<?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: Calculating quarterly historical average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3283108#M121978</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="574311" data-lia-user-login="mgarcianxp" class="lia-mention lia-mention-user"&gt;mgarcianxp&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try to create a CALENDAR table to help calculation.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Calendar =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Quarter", QUARTER ( [Date] ),
    "Month", MONTH ( [Date] )
)&lt;/LI-CODE&gt;
&lt;P&gt;Create a relationship between 'Calendar'[Date] and 'Fact Table'[Date].&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AVERAGE BY QUARTER =
AVERAGEX (
    ALLEXCEPT ( Calendar, Calendar[Year], Calendar[Quarter] ),
    'Fact Table'[DIO]
)&lt;/LI-CODE&gt;
&lt;P&gt;If this reply still couldn't help you solve your issue, please share a sample file with me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2023 07:35:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-06-14T07:35:18Z</dc:date>
    <item>
      <title>Calculating quarterly historical average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3279980#M121814</link>
      <description>&lt;P&gt;I am new to Power BI, and dont have much DAX experience. I've tried to find a post that helps me with this, but have not found any.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to replicate the excel chart below in PowerBI and I am having trouble to write the DAX code for the historical average (red line).&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DOI values are not in a table but they are a measure. The historical average is supposed to be the 5-years quarterly seasonality: Per quarter: average of the DIO from 2015 to 2019. So basically, I need to calculate 4 values and repeate them on each quarters for all years.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help!!&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>Mon, 12 Jun 2023 16:28:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3279980#M121814</guid>
      <dc:creator>mgarcianxp</dc:creator>
      <dc:date>2023-06-12T16:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating quarterly historical average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3280311#M121834</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="574311" data-lia-user-login="mgarcianxp" class="lia-mention lia-mention-user"&gt;mgarcianxp&lt;/a&gt;&amp;nbsp;check link for rolling average (monthly) and adjust for your requirements (quarterly)&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;I hope this help&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2023 21:40:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3280311#M121834</guid>
      <dc:creator>some_bih</dc:creator>
      <dc:date>2023-06-12T21:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating quarterly historical average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3282057#M121922</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="555045" data-lia-user-login="some_bih" class="lia-mention lia-mention-user"&gt;some_bih&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for the answer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not looking for the rolling average, but the historical average is static. Anyway I have solved it in a probabl not very efficien way, by creating a calculated table instead of a measuers table, then filtering it 4 times for the 4 quarters to calculate the average of each quarter, so I can have a measure that repeats itselve thoruout the yerars.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not very elegant, but it's working &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thansk again&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2023 15:31:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3282057#M121922</guid>
      <dc:creator>mgarcianxp</dc:creator>
      <dc:date>2023-06-13T15:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating quarterly historical average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3283108#M121978</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="574311" data-lia-user-login="mgarcianxp" class="lia-mention lia-mention-user"&gt;mgarcianxp&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try to create a CALENDAR table to help calculation.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Calendar =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Quarter", QUARTER ( [Date] ),
    "Month", MONTH ( [Date] )
)&lt;/LI-CODE&gt;
&lt;P&gt;Create a relationship between 'Calendar'[Date] and 'Fact Table'[Date].&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;AVERAGE BY QUARTER =
AVERAGEX (
    ALLEXCEPT ( Calendar, Calendar[Year], Calendar[Quarter] ),
    'Fact Table'[DIO]
)&lt;/LI-CODE&gt;
&lt;P&gt;If this reply still couldn't help you solve your issue, please share a sample file with me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 07:35:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3283108#M121978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-14T07:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating quarterly historical average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3285614#M122131</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the reply, I managed to solve the issue in a different way &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; #&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 09:36:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3285614#M122131</guid>
      <dc:creator>mgarcianxp</dc:creator>
      <dc:date>2023-06-15T09:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating quarterly historical average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3285837#M122159</link>
      <description>&lt;P&gt;I reworked my solution and used your proposal, as mine was less elegant &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 11:59:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3285837#M122159</guid>
      <dc:creator>mgarcianxp</dc:creator>
      <dc:date>2023-06-15T11:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating quarterly historical average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3286496#M122202</link>
      <description>&lt;P&gt;Hi again,&amp;nbsp;&lt;/P&gt;&lt;P&gt;still struggling with the average of a measure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I solved the issue above by creating a table instead of working with measures. This is working fine for the total values (aggregate of all the companies). But I still want to do it without the additional table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is how the average is calculated in the case where DOI is a column:&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Average is calculated as follows:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;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IV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;This is the calculation in the case where DOI is a measure:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DOI Q1 Avrg. = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;AVERAGEX&lt;/SPAN&gt;&lt;SPAN&gt;('|Measures OEM','|Measures OEM'[DOI per OEM]),&lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;('|Calendar','|Calendar'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Quarter]),&lt;/SPAN&gt;&lt;SPAN&gt;AND&lt;/SPAN&gt;&lt;SPAN&gt;('|Calendar'[Qtr]=&lt;/SPAN&gt;&lt;SPAN&gt;"Q1"&lt;/SPAN&gt;&lt;SPAN&gt;,'|Calendar'[Date] &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;2019&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;12&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;31&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The both tables below show the results for both cases. How can I get the results of the left table using the measure? Thanks!&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;&lt;P&gt;&amp;nbsp;&lt;/P&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>Thu, 15 Jun 2023 17:05:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-quarterly-historical-average/m-p/3286496#M122202</guid>
      <dc:creator>mgarcianxp</dc:creator>
      <dc:date>2023-06-15T17:05:55Z</dc:date>
    </item>
  </channel>
</rss>

