<?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: Average % of year over the last five years in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-year-over-the-last-five-years/m-p/2599342#M75096</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please create these four measures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TD = 
VAR _year = YEAR(MAX('Date'[Date]))
VAR _month = MONTH(TODAY())
VAR _day = DAY(TODAY())
VAR _result = 
CALCULATE(
    [Result],
        FILTER(
            ALL('Date'),
                'Date'[Date] &amp;gt;= DATE(_year,1,1)
                    &amp;amp;&amp;amp; 'Date'[Date] &amp;lt;= DATE(_year,_month,_day) 
                        &amp;amp;&amp;amp; _year &amp;lt;&amp;gt; YEAR(TODAY())
        )
)
RETURN
_result&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;% = 
AVERAGEX(SUMMARIZE('Date','Date'[Year],"M1",[YTD],"M2",[Result]),DIVIDE([M1],[M2]))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;YTD = 
CALCULATE(
    [Result],
    DATESYTD('Date'[Date])
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Expected values = 
DIVIDE([YTD],[%])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Attached PBIX file for your reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to get your questions answered quickly&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;--&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to provide sample data&lt;/SPAN&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 04:58:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-06-24T04:58:49Z</dc:date>
    <item>
      <title>Average % of year over the last five years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-year-over-the-last-five-years/m-p/2592573#M74717</link>
      <description>&lt;P&gt;I have got a measure called [Result], the table this measure is based on is connected with a Date table with a Date column, [Date].[Date]. Given that today is 21st of june 2022, I would like to calculate the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Average production % of entire year in the same period for the last 5 years:&lt;BR /&gt;[Result] for 01-01 until 06-21 divided by [Result] for the entire year&lt;BR /&gt;Example: 2021-01-01 until 2021-06-21 has a result of 240, entire year has 500; so outcome is 0,48&lt;BR /&gt;Let's say the results for 2016-2021 are:&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Year&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;01-01 until 06-21&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Entire Year&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;%&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2017&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;0.42&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;0.54&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2019&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;0.50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2020&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;0.46&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;240&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;0.48&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Average %&lt;/TD&gt;&lt;TD&gt;0.48&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/LI&gt;&lt;LI&gt;I would like to divide my [Result] for the current year so far (so until 2022-06-21) with the given average in order to estimate my [Result] for the entire year, given patterns from the last 5 years. So if my result for 2022-01-01 until 2022-06-21 would be 330, my outcome would be 330 divided by 0.48 resulting in 687.5.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have no idea how to get started. This is way above my DAX knowledge. Can you please help me with this case?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if I need to provide any other data or to clarify anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 14:55:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-year-over-the-last-five-years/m-p/2592573#M74717</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T14:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Average % of year over the last five years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-year-over-the-last-five-years/m-p/2599342#M75096</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please create these four measures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TD = 
VAR _year = YEAR(MAX('Date'[Date]))
VAR _month = MONTH(TODAY())
VAR _day = DAY(TODAY())
VAR _result = 
CALCULATE(
    [Result],
        FILTER(
            ALL('Date'),
                'Date'[Date] &amp;gt;= DATE(_year,1,1)
                    &amp;amp;&amp;amp; 'Date'[Date] &amp;lt;= DATE(_year,_month,_day) 
                        &amp;amp;&amp;amp; _year &amp;lt;&amp;gt; YEAR(TODAY())
        )
)
RETURN
_result&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;% = 
AVERAGEX(SUMMARIZE('Date','Date'[Year],"M1",[YTD],"M2",[Result]),DIVIDE([M1],[M2]))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;YTD = 
CALCULATE(
    [Result],
    DATESYTD('Date'[Date])
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Expected values = 
DIVIDE([YTD],[%])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Attached PBIX file for your reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;Best Regards,&lt;BR /&gt;Gao&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;Community Support Team&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;If there is any post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3" color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT size="3"&gt;&lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT size="3"&gt;Thanks a lot!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2" color="#FF0000"&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to get your questions answered quickly&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;--&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;How to provide sample data&lt;/SPAN&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 04:58:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-year-over-the-last-five-years/m-p/2599342#M75096</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-24T04:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Average % of year over the last five years</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-year-over-the-last-five-years/m-p/2603290#M75316</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, took me a little while to check against my own results but your solution fits perfectly!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jun 2022 07:58:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-year-over-the-last-five-years/m-p/2603290#M75316</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-27T07:58:16Z</dc:date>
    </item>
  </channel>
</rss>

