<?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 DAX code assistance please: in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851126#M91395</link>
    <description>&lt;P&gt;Hi there please would someone be able to assist with a 14 day rolling average query for a column calculation in PBI,&lt;/P&gt;&lt;P&gt;Dates are dd/mm/yy and I have Currency data in the Budget column I am looking to write a formula for the 14 day rolling total from which to calculate the rolling average.&lt;/P&gt;&lt;P&gt;The following formula only returns a rolling 1 day average:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rolling Budget = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;SPAN&gt;(INFEED[BUDGET]),&lt;/SPAN&gt;&lt;SPAN&gt;DATESINPERIOD&lt;/SPAN&gt;&lt;SPAN&gt;('INFEED'[DATE]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date],&lt;/SPAN&gt;&lt;SPAN&gt;LASTDATE&lt;/SPAN&gt;&lt;SPAN&gt;('INFEED'[DATE]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date]),&lt;/SPAN&gt;&lt;SPAN&gt;14&lt;/SPAN&gt;&lt;SPAN&gt;,DAY))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;With thanks &amp;amp; kind regards, Singh,&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 19 Oct 2022 10:47:54 GMT</pubDate>
    <dc:creator>Tony_Singh</dc:creator>
    <dc:date>2022-10-19T10:47:54Z</dc:date>
    <item>
      <title>DAX code assistance please:</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851126#M91395</link>
      <description>&lt;P&gt;Hi there please would someone be able to assist with a 14 day rolling average query for a column calculation in PBI,&lt;/P&gt;&lt;P&gt;Dates are dd/mm/yy and I have Currency data in the Budget column I am looking to write a formula for the 14 day rolling total from which to calculate the rolling average.&lt;/P&gt;&lt;P&gt;The following formula only returns a rolling 1 day average:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rolling Budget = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;SPAN&gt;(INFEED[BUDGET]),&lt;/SPAN&gt;&lt;SPAN&gt;DATESINPERIOD&lt;/SPAN&gt;&lt;SPAN&gt;('INFEED'[DATE]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date],&lt;/SPAN&gt;&lt;SPAN&gt;LASTDATE&lt;/SPAN&gt;&lt;SPAN&gt;('INFEED'[DATE]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date]),&lt;/SPAN&gt;&lt;SPAN&gt;14&lt;/SPAN&gt;&lt;SPAN&gt;,DAY))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;With thanks &amp;amp; kind regards, Singh,&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 19 Oct 2022 10:47:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851126#M91395</guid>
      <dc:creator>Tony_Singh</dc:creator>
      <dc:date>2022-10-19T10:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: DAX code assistance please:</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851183#M91406</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458846" data-lia-user-login="Tony_Singh" class="lia-mention lia-mention-user"&gt;Tony_Singh&lt;/a&gt;&amp;nbsp;Try:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rolling Average Measure =
  VAR __MaxDate = MAX('DATE'[Date])
  VAR __MinDate = __MaxDate - 14
RETURN
  SUMX(FILTER('INFEED',[Date] &amp;gt;= __MinDate &amp;amp;&amp;amp; [Date] &amp;lt;= __MaxDate),[BUDGET])&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Oct 2022 11:19:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851183#M91406</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-10-19T11:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: DAX code assistance please:</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851219#M91409</link>
      <description>&lt;P&gt;Hi Greg, as I am newbie please do not take any offence this works as a caluclated measure however how would i write that as a column command, kind regards &amp;amp; thanks, Singh,&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 11:38:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851219#M91409</guid>
      <dc:creator>Tony_Singh</dc:creator>
      <dc:date>2022-10-19T11:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: DAX code assistance please:</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851251#M91413</link>
      <description>&lt;P&gt;Hi Greg, I have looked in the book also, I have the first edition, still struggling with the technicality, I have copied and pasted the code from your reply into the formula bar and I get a value of 1875 which is 15*125, the 125 is the last daily value for the daily budget ie 31/12/2024,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 12:02:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851251#M91413</guid>
      <dc:creator>Tony_Singh</dc:creator>
      <dc:date>2022-10-19T12:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: DAX code assistance please:</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851582#M91426</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458846" data-lia-user-login="Tony_Singh" class="lia-mention lia-mention-user"&gt;Tony_Singh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Rolling Budget =
VAR CurrentDate = 'INFEED'[DATE]
VAR PreviousDate = CurrentDate - 14
RETURN
    CALCULATE (
        SUM ( INFEED[BUDGET] ),
        'INFEED'[DATE] &amp;lt;= CurrentDate,
        'INFEED'[DATE] &amp;gt;= PreviousDate
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Oct 2022 14:24:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851582#M91426</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-10-19T14:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: DAX code assistance please:</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851635#M91431</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Hi there, it is only returning the single value ie the pickup value,&lt;/P&gt;&lt;P&gt;In essence we need to aggregate the first 14 days ie 1-14, then 2-15, then 3-16 and so on a bit of a dilema,&lt;/P&gt;&lt;P&gt;Any further suggestions?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2022 14:46:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851635#M91431</guid>
      <dc:creator>Tony_Singh</dc:creator>
      <dc:date>2022-10-19T14:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: DAX code assistance please:</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851954#M91460</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="458846" data-lia-user-login="Tony_Singh" class="lia-mention lia-mention-user"&gt;Tony_Singh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My mistake. Somehow I missed to remove the filters.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Rolling Budget =
VAR CurrentDate = 'INFEED'[DATE]
VAR PreviousDate = CurrentDate - 14
RETURN
    CALCULATE (
        SUM ( INFEED[BUDGET] ),
        'INFEED'[DATE] &amp;lt;= CurrentDate,
        'INFEED'[DATE] &amp;gt;= PreviousDate,
        REMOVEFILTERS ()
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Oct 2022 18:33:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-code-assistance-please/m-p/2851954#M91460</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-10-19T18:33:16Z</dc:date>
    </item>
  </channel>
</rss>

