<?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 future sales in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3587338#M138434</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="338956" data-lia-user-login="mrclay82" class="lia-mention lia-mention-user"&gt;mrclay82&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average Future Sales Next 3 Weeks =
VAR currentweek =
    SELECTEDVALUE ( yourtable[week] )
RETURN
    CALCULATE (
        AVERAGEX ( VALUES ( 'YourTable'[Week] ), [salesmeasure] ),
        yourtable[week] &amp;gt; currentweek,
        yourtable[week] &amp;lt;= currentweek + 3
    )
&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 17 Dec 2023 08:04:56 GMT</pubDate>
    <dc:creator>Fowmy</dc:creator>
    <dc:date>2023-12-17T08:04:56Z</dc:date>
    <item>
      <title>Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3585816#M138338</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a measure called [future sales] which shows the forecasted sales per week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to calculate the average of this measure for the next 3 weeks and group the result by week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if the table is as below (pretending the week number is currently 30), the outcome should be 17,66 for week 30 (20+15+18)/3:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Week 30, future sales = 10&lt;/P&gt;&lt;P&gt;Week 31, future sales = 20&lt;/P&gt;&lt;P&gt;Week 32, future sales = 15&lt;/P&gt;&lt;P&gt;Week 33, future sales = 18&lt;/P&gt;&lt;P&gt;Week 34, future sales = 12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Figures in red are the desired outcome:&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&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;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 13:23:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3585816#M138338</guid>
      <dc:creator>mrclay82</dc:creator>
      <dc:date>2023-12-15T13:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3587338#M138434</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="338956" data-lia-user-login="mrclay82" class="lia-mention lia-mention-user"&gt;mrclay82&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Average Future Sales Next 3 Weeks =
VAR currentweek =
    SELECTEDVALUE ( yourtable[week] )
RETURN
    CALCULATE (
        AVERAGEX ( VALUES ( 'YourTable'[Week] ), [salesmeasure] ),
        yourtable[week] &amp;gt; currentweek,
        yourtable[week] &amp;lt;= currentweek + 3
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 17 Dec 2023 08:04:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3587338#M138434</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2023-12-17T08:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593101#M138761</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/52518" target="_blank"&gt;@Fowmy&lt;/A&gt;&amp;nbsp;!&lt;BR /&gt;&lt;BR /&gt;It doesn't work all the way, probably due to insufficient info from my part.&lt;BR /&gt;&lt;BR /&gt;What happens is that it is totally overriding my date filters and showing me earlier dates (historical dates) instead of future dates.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have a page filter that filters the page with a calculated column called 'forecasttable'[thisweek] which I have checked "Y" to only give me the future sales which is imported for this week.&lt;BR /&gt;&lt;BR /&gt;I tried to modify your measure like this:&lt;/P&gt;&lt;P&gt;Average Future Sales Next 3 Weeks =&lt;/P&gt;&lt;P&gt;VAR currentweek =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECTEDVALUE ( yourtable[week] )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALCULATE (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AVERAGEX ( VALUES ( 'YourTable'[Week] ), [salesmeasure] ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yourtable[week] &amp;gt; currentweek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yourtable[week] &amp;lt;= currentweek + 3,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; KEEPFILTERS(‘forecasttable’)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;This gives me the correct dates (only showing the future, but the measure output is blank.&lt;BR /&gt;&lt;BR /&gt;When modifying the measure like this:&lt;/P&gt;&lt;P&gt;Average Future Sales Next 3 Weeks =&lt;/P&gt;&lt;P&gt;VAR currentweek =&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECTEDVALUE ( yourtable[week] )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CALCULATE (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AVERAGEX ( VALUES ( 'YourTable'[Week] ), [salesmeasure] ),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yourtable[week] &amp;gt; currentweek,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yourtable[week] &amp;lt;= currentweek + 3,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; KEEPFILTERS(‘forecasttable’[thisweek])&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;I get the following error: "Cannot convert value 'N' of type Text to type True/False".&lt;BR /&gt;&lt;BR /&gt;Do you know the approach here? Please let me know if you need additional info.&lt;BR /&gt;&lt;BR /&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 07:57:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593101#M138761</guid>
      <dc:creator>mrclay82</dc:creator>
      <dc:date>2023-12-20T07:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593385#M138793</link>
      <description>&lt;P&gt;HI,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="338956" data-lia-user-login="mrclay82" class="lia-mention lia-mention-user"&gt;mrclay82&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;measure =
var currentweek = max(tablename[week])
return
averagex(
    filter(
        all(tablename[week]),
        tablename[week]&amp;gt; currentweek &amp;amp;&amp;amp;
        tablename[week] &amp;lt;= tablename[week]+3
     )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Dec 2023 09:48:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593385#M138793</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2023-12-20T09:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593553#M138806</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Haven't tried yet but shouldn't my future sales measure be included there?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 10:42:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593553#M138806</guid>
      <dc:creator>mrclay82</dc:creator>
      <dc:date>2023-12-20T10:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593565#M138808</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="338956" data-lia-user-login="mrclay82" class="lia-mention lia-mention-user"&gt;mrclay82&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Sharing a dummy Power BI file representing your scenario would be beneficial. You can save the Power BI file on Google Drive or any other cloud storage platform and provide the link here. Kindly ensure that permission is granted to open the file.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 10:48:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593565#M138808</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2023-12-20T10:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593598#M138814</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="338956" data-lia-user-login="mrclay82" class="lia-mention lia-mention-user"&gt;mrclay82&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;try updated code i am forgot to write [measure]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;measure =
var currentweek = max(tablename[week])
return
averagex(
    filter(
        all(tablename[week]),
        tablename[week]&amp;gt; currentweek &amp;amp;&amp;amp;
        tablename[week] &amp;lt;= tablename[week]+3
     ),
[salesmeasure]
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Dec 2023 10:59:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3593598#M138814</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2023-12-20T10:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3642715#M141027</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="569583" data-lia-user-login="Dangar332" class="lia-mention lia-mention-user"&gt;Dangar332&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This measure&amp;nbsp;&lt;SPAN&gt;overrides the date filters showing me earlier dates (historical dates) instead of future dates. My salesmeasure is a sum of a future sales column, only containing future values. But your measure breaks this showing only historical values with the same output all across.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 06:24:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3642715#M141027</guid>
      <dc:creator>mrclay82</dc:creator>
      <dc:date>2024-01-17T06:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3642718#M141028</link>
      <description>&lt;P&gt;Is there another way? More info from my part? It is a fairy complex data model to replicate.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 06:25:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3642718#M141028</guid>
      <dc:creator>mrclay82</dc:creator>
      <dc:date>2024-01-17T06:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3642863#M141040</link>
      <description>&lt;P&gt;Actually this worked after applying a date filter on the page! Many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 07:35:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3642863#M141040</guid>
      <dc:creator>mrclay82</dc:creator>
      <dc:date>2024-01-17T07:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Average of future sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3643076#M141055</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="338956" data-lia-user-login="mrclay82" class="lia-mention lia-mention-user"&gt;mrclay82&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Can you share some sample data with the desired output to have a clear understanding of your question?&lt;BR /&gt;You can either paste your data in the reply box or&amp;nbsp;save it in OneDrive, Google Drive, or any other cloud-sharing platform and share the link here.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jan 2024 08:56:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Average-of-future-sales/m-p/3643076#M141055</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2024-01-17T08:56:42Z</dc:date>
    </item>
  </channel>
</rss>

