<?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: 5-Day Moving Average in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1355571#M24481</link>
    <description>&lt;P&gt;I want to thank everyone for their advice...I had tried adapting similar solutions, but could not get anything to work for what I needed. I recognize the problem of not being able to post the data...the data set is large.&amp;nbsp; I could pare it down to just a couple of counties and 10-20 days, I guess, and post that. If you look at the inelegant solution I ended up with, you might be able to tell from that what I would need to do to write a smarter DAX query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rip&lt;/P&gt;</description>
    <pubDate>Tue, 08 Sep 2020 16:12:07 GMT</pubDate>
    <dc:creator>ripstaur</dc:creator>
    <dc:date>2020-09-08T16:12:07Z</dc:date>
    <item>
      <title>5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349168#M24240</link>
      <description>&lt;P&gt;I have a dataset from GitHub containing cumulative daily Covid19 Deaths and Confirmed cases. It took me a while, but I finally found a solution to one problem, which was calculating a daily difference so I could get "new cases" and "new deaths." This seemed to be impossible in M but I did modify a solution I found for DAX, and it worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, however, I have spent two days trying to find a way to get a 5- or 7-day moving average. The expression would need to work for the county level, but I would also need to be able to aggregate at the state level and the "entire country" grand-total level.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is pretty easy to do in Tableau, and maybe it is as well in Power BI, but it's very difficult to find the actual answer I need. I either get cryptic error messages or wildly incorrect values when I try the various solutions I find in these online blog posts. DAX, M, Power BI...they all need some debugging function and error tracing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Sep 2020 18:20:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349168#M24240</guid>
      <dc:creator>ripstaur</dc:creator>
      <dc:date>2020-09-05T18:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349184#M24241</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250685" data-lia-user-login="ripstaur" class="lia-mention lia-mention-user"&gt;ripstaur&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Create the following measure to calculate the 5 days moving average of daily cases. Make sure you have created a dates table and linked it to the case table. This should work when you filter by country or state.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;5 Days MA = 
IF( NOT ISEMPTY('Table'),
    AVERAGEX(
        DATESINPERIOD(Dates[Date],MAX(Dates[Date]),-5,DAY),
        CALCULATE(SUM('Table'[Daily Cases]))
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;If this doesn't answer your question, share some sample data and the expected result to have a clear understanding of your question?&lt;BR /&gt;You can save your files in OneDrive, Google Drive, or any other cloud sharing platforms and share the link here.&lt;BR /&gt;____________________________________&lt;BR /&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;How to paste sample data with your question?&lt;/A&gt;&lt;BR /&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;How to get your questions answered quickly?&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;_____________________________________&lt;BR /&gt;Did I answer your question? Mark this post as a solution, this will help others!.&lt;/P&gt;&lt;P&gt;Click on the Thumbs-Up icon if you like this reply &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;I&gt;&lt;A href="https://www.youtube.com/channel/UCKwBEguA8IlBubIobaOormg?sub_confirmation=1" target="_blank" rel="noopener"&gt;YouTube, &lt;/A&gt;&lt;A href="https://linkedin.com/in/fowmy" target="_blank" rel="noopener"&gt;LinkedIn&lt;/A&gt;&lt;/I&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Sep 2020 19:02:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349184#M24241</guid>
      <dc:creator>Fowmy</dc:creator>
      <dc:date>2020-09-05T19:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349209#M24242</link>
      <description>&lt;LI-CODE lang="csharp"&gt;// Depending on the model you have...
// But let's assume that:
// You have a Dates table that's connected
// to your fact table. Say the fact table
// is Cases and stores the following columns:
// 1. Date (Dates joins on this field)
// 2. CityID
// 3. NewCaseCount
// 4. DeathCount
// There'll be other dimensions but they're
// not relevant. Of course, fact table should
// have all its columns hidden. Slicing only
// via dimensions is allowed.

[New Cases] = SUM( Cases[NewCaseCount] )

[New Case Avg (5D)] =
// change this to 7 to get a weekly
// moving avg
var __numOfDays = 5 
var __lastVisibleDay = MAX( Dates[Date] )
var __daysToAvgOver =
    DATESINPERIOD(
        Dates[Date],
        __lastVisibleDay,
        -__numOfDays,
        DAY
    )
var __enoughDays =
    COUNTROWS( __daysToAvgOver ) = __numOfDays
var __avg =
    if( __enoughDays,
        CALCULATE(
            [New Cases],
            // this will work OK if
            // Dates is marked as a
            // Date table in the model
            __daysToAvgOver
        )
    )
return
    __avg

[Deaths] = SUM( Cases[DeathCount] )

[Death Count Avg (5D)] =
// change this to 7 to get a weekly
// moving avg
var __numOfDays = 5 
var __lastVisibleDay = MAX( Dates[Date] )
var __daysToAvgOver =
    DATESINPERIOD(
        Dates[Date],
        __lastVisibleDay,
        -__numOfDays,
        DAY
    )
var __enoughDays =
    COUNTROWS( __daysToAvgOver ) = __numOfDays
var __avg =
    if( __enoughDays,
        CALCULATE(
            [Deaths],
            // this will work OK if
            // Dates is marked as a
            // Date table in the model
            __daysToAvgOver
        )
    )
return
    __avg    
    
// By the way, in M you can do anything,
// even more than in DAX, so it's certain
// that the calculation you're talking about
// CAN BE done in M.&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 05 Sep 2020 20:17:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349209#M24242</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2020-09-05T20:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349210#M24243</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250685" data-lia-user-login="ripstaur" class="lia-mention lia-mention-user"&gt;ripstaur&lt;/a&gt;&amp;nbsp;- I like&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="52518" data-lia-user-login="Fowmy" class="lia-mention lia-mention-user"&gt;Fowmy&lt;/a&gt;&amp;nbsp;'s solution, seems like it should work. Nice and simple. There is a Quick Measure Gallery submission that should work as well.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Rolling-Average/m-p/160720#M3" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Rolling-Average/m-p/160720#M3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could also be done without the time intelligence functions if necessary (in an RLS or Direct Query situation), in theory:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Moving 5 Day Average =
  VAR __MaxDay = MAX('Table'[Date])
RETURN
  AVERAGEX(FILTER(ALL('Table'),[Date]&amp;lt;=__MaxDay &amp;amp;&amp;amp; [Date]&amp;gt;=__MaxDay-5),[Value])
&lt;/LI-CODE&gt;
&lt;P&gt;You may find this helpful - &lt;A href="https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, ultimately, actual sample data would be tremendously helpful to be very specific with a solution.&lt;/P&gt;
&lt;P&gt;Not really enough information to go on, please first check if your issue is a common issue listed here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The most important parts are:&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Sep 2020 20:22:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349210#M24243</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-05T20:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349246#M24246</link>
      <description>And I don't like &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="52518" data-lia-user-login="Fowmy" class="lia-mention lia-mention-user"&gt;Fowmy&lt;/a&gt;'s solution as it breaks down when we are too close to the left edge of the calendar (Dates).</description>
      <pubDate>Sat, 05 Sep 2020 21:52:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349246#M24246</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2020-09-05T21:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349324#M24250</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255913" data-lia-user-login="daxer-almighty" class="lia-mention lia-mention-user"&gt;daxer-almighty&lt;/a&gt; , How about taking a sum and divide by days in &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="52518" data-lia-user-login="Fowmy" class="lia-mention lia-mention-user"&gt;Fowmy&lt;/a&gt;&amp;nbsp; solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As mesures&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rolling 5 = Divide(CALCULATE(Sum('Table'[Daily Cases]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-5,Day)) ,CALCULATE(distinctcount('Table'[Date]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-5,Day)))&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;Rolling 5 = CALCULATE(Divide(Sum('Table'[Daily Cases]),distinctcount('Table'[Date])),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-5,Day))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With a date table.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Sep 2020 02:36:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349324#M24250</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-06T02:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349791#M24283</link>
      <description>&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;You can't calculate 5D average if you don't have 5 days (too close to the left edge of the calendar), so you're targeting a completely different area that has nothing to do with the problem I'm talking about.</description>
      <pubDate>Sun, 06 Sep 2020 14:36:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349791#M24283</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2020-09-06T14:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349887#M24300</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="255913" data-lia-user-login="daxer-almighty" class="lia-mention lia-mention-user"&gt;daxer-almighty&lt;/a&gt;&amp;nbsp;, that is the same idea to count date from the table in the denominator. So if there are not fine days, it divides that many number of days&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Sep 2020 16:28:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1349887#M24300</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-06T16:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1351798#M24374</link>
      <description>&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;"So if there are not fine days, it divides that many number of days"&lt;BR /&gt;&lt;BR /&gt;Such a calculation is NOT 5D average. You're distorting the data this way.</description>
      <pubDate>Mon, 07 Sep 2020 11:19:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1351798#M24374</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-07T11:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1355522#M24476</link>
      <description>&lt;P&gt;I did cobble this solution together. It's not elegant - it is my rookie brute-force solution. It works, though. I'm sure there is a function that could radically streamline this code. I copied this in from a .txt file, and can't seem to get the tabs working...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Five Day MA New Cases =&lt;BR /&gt;VAR CasesPreviousDay =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'Covid-confirmed'[New Cases] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;ALL ( 'Covid-confirmed' ),&lt;BR /&gt;'Covid-confirmed'[Date]&lt;BR /&gt;= EARLIER ( 'Covid-confirmed'[Date] ) - 1&lt;BR /&gt;&amp;amp;&amp;amp; 'Covid-confirmed'[FIPS Code] = EARLIER ( 'Covid-confirmed'[FIPS Code] )&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR CasesTwoDaysAgo =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'Covid-confirmed'[New Cases] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;ALL ( 'Covid-confirmed' ),&lt;BR /&gt;'Covid-confirmed'[Date]&lt;BR /&gt;= EARLIER ( 'Covid-confirmed'[Date] ) - 2&lt;BR /&gt;&amp;amp;&amp;amp; 'Covid-confirmed'[FIPS Code] = EARLIER ( 'Covid-confirmed'[FIPS Code] )&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR CasesThreeDaysAgo =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'Covid-confirmed'[New Cases] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;ALL ( 'Covid-confirmed' ),&lt;BR /&gt;'Covid-confirmed'[Date]&lt;BR /&gt;= EARLIER ( 'Covid-confirmed'[Date] ) - 1&lt;BR /&gt;&amp;amp;&amp;amp; 'Covid-confirmed'[FIPS Code] = EARLIER ( 'Covid-confirmed'[FIPS Code] )&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;VAR CasesFourDaysAgo =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'Covid-confirmed'[New Cases] ),&lt;BR /&gt;FILTER (&lt;BR /&gt;ALL ( 'Covid-confirmed' ),&lt;BR /&gt;'Covid-confirmed'[Date]&lt;BR /&gt;= EARLIER ( 'Covid-confirmed'[Date] ) - 1&lt;BR /&gt;&amp;amp;&amp;amp; 'Covid-confirmed'[FIPS Code] = EARLIER ( 'Covid-confirmed'[FIPS Code] )&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;('Covid-confirmed'[New Cases] + CasesPreviousDay + CasesTwoDaysAgo + CasesThreeDaysAgo + CasesFourDaysAgo) / 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 15:51:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1355522#M24476</guid>
      <dc:creator>ripstaur</dc:creator>
      <dc:date>2020-09-08T15:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1355571#M24481</link>
      <description>&lt;P&gt;I want to thank everyone for their advice...I had tried adapting similar solutions, but could not get anything to work for what I needed. I recognize the problem of not being able to post the data...the data set is large.&amp;nbsp; I could pare it down to just a couple of counties and 10-20 days, I guess, and post that. If you look at the inelegant solution I ended up with, you might be able to tell from that what I would need to do to write a smarter DAX query.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rip&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 16:12:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1355571#M24481</guid>
      <dc:creator>ripstaur</dc:creator>
      <dc:date>2020-09-08T16:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: 5-Day Moving Average</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1355617#M24484</link>
      <description>&lt;P&gt;Thanks for this, and for the advice about M and DAX. I think I can adapt some of this to streamline my code. The one thing I don't see in this solution is a way to aggregate (or filter - not sure what the right word is in DAX/M) by FIPS Code, so I'm essentially getting the averages by county. I'm also not concerned over the number of days available...this record is long, and I don't show the first couple of weeks in most of my visualizations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not much of a coder - I took some basic (not VB, basic) classes years ago and used to be able to write pretty good stuff in that, and for several years I wrote databases in DB3 and DB4, but I got away from that and have been mostly doing analysis using SPSS and Minitab until a few years ago, when I was on a job that where they were using Qlikview, so I got certified as a Qlikview developer. Then they shifted to Tableau, and I was fat, dumb and happy using Tableau. Now I am working with an organization that decided to shift from Tableau to Power BI "to save money." So now I am in this environment, and having to code things that were simpler in other packages, using two new and different languages, without any formal training in either one.&lt;/P&gt;&lt;P&gt;Last week my challenge with this dataset was to find daily differences. I was unable to find anything in M that would do it (although I do believe there has to be that functionality, and would rather have done it there, in "Edit Queries"). I did find some DAX code in one of the Power BI or Power Query forums. I adapted it, and then ended up just modifying and iterating it to get the solution I wrote above.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Sep 2020 16:32:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/5-Day-Moving-Average/m-p/1355617#M24484</guid>
      <dc:creator>ripstaur</dc:creator>
      <dc:date>2020-09-08T16:32:18Z</dc:date>
    </item>
  </channel>
</rss>

