<?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 the moving average of previous 4 weeks sales compared to last week sales in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1182009#M18463</link>
    <description>&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt; &lt;LI-CODE lang="markup"&gt;Perakende Karşılaştırmalı = 
(IF(
    ISFILTERED('Sayfa1'[Date]),
   
        AVERAGEX(
            DATESBETWEEN(
                'Sayfa1'[Date],
                (TODAY()-6),
                (TODAY())
            ),
            CALCULATE(SUM('Sayfa1'[Sales]))
        )
)
)/  
IF(
    ISFILTERED('Sayfa1'[Date]),

        SUMX(
            DATESBETWEEN(
                'Sayfa1'[Date],
                (TODAY()-34),
                (TODAY()-7)
            ),
            CALCULATE(SUM('Sayfa1'[Sales]))
        )/4
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jun 2020 10:00:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-06-25T10:00:40Z</dc:date>
    <item>
      <title>Calculating the moving average of previous 4 weeks sales compared to last week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180544#M18389</link>
      <description>&lt;P&gt;I have really problem about this:( I hope u can help me about this topic.&lt;/P&gt;&lt;P&gt;Thank u before your answers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today=X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to solve this porblem with dax.&lt;/P&gt;&lt;P&gt;My data occured&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sales date, Amount and P&lt;SPAN&gt;roduct type. Each data correleated with each other.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Aim: Weekly moving average of total weekly sales by day, compared to the total of last 4 week sales&lt;/P&gt;&lt;P&gt;X to X-6 total sales amount / (X-7 to X-34)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 21:15:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180544#M18389</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-24T21:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the moving average of previous 4 weeks sales compared to last week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180616#M18395</link>
      <description>&lt;P&gt;Use variables to break the problem down&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;measure =&lt;/P&gt;&lt;P&gt;var today=max([date])&lt;/P&gt;&lt;P&gt;var lastseven = calculate(sum([Sales]),[date]&amp;gt;today-7)&lt;/P&gt;&lt;P&gt;var lastthirtyfive =&amp;nbsp;calculate(sum([Sales]),[date]&amp;gt;today-35)&lt;/P&gt;&lt;P&gt;return divide (lastseven,lastthirtyfive-lastseven)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adjust the column names as needed.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 21:51:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180616#M18395</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-06-24T21:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the moving average of previous 4 weeks sales compared to last week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180746#M18406</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am grateful for your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wıll send my page because ı am not solve this problem. It ıs so complicated now:(.&amp;nbsp; I hope u can help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My aım:&amp;nbsp;&lt;/P&gt;&lt;P&gt;If today 25.06.2020, (sum of total sales of 25.06.2020 to 19.06.2020) / ((sum of total sales 18.06.2020 to 22.05.2020) /4)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A = sum of total sales of 25.06.2020 to 19.06.2020&lt;/P&gt;&lt;P&gt;B =&amp;nbsp;(sum of total sales 18.06.2020 to 22.05.2020)&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A/(B/4)&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 23:39:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180746#M18406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-24T23:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the moving average of previous 4 weeks sales compared to last week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180747#M18407</link>
      <description>&lt;P&gt;so you don't want to compare the last seven days to the 28 days before that, but rather to their average.&amp;nbsp; In that case just multiply by 4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;measure =
var today=max([date])
var lastseven = calculate(sum([Sales]),[date]&amp;gt;today-7)
var lastthirtyfive = calculate(sum([Sales]),[date]&amp;gt;today-35)
return divide (4*lastseven,lastthirtyfive-lastseven)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also see that you have created all separate measures. Please don't do that. The above code has to go into the definition of your single measure. The variables are part of the measure definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 23:12:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180747#M18407</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-06-24T23:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the moving average of previous 4 weeks sales compared to last week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180763#M18411</link>
      <description>&lt;P&gt;I thınk smt is wrong on my page,&lt;/P&gt;&lt;P&gt;Maybe my problem is related in [Date]?&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="tw-menu"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="oSioSc"&gt;&lt;DIV&gt;&lt;DIV class="g9WsWb"&gt;&lt;DIV class="tw-ta-container hide-focus-ring tw-nfl"&gt;&lt;PRE&gt;&lt;SPAN&gt;On the chart I want to see:

For example: Based on the 14th of May, the ratio of 4 * (8-14th of May total sales) to the sales of 7th May - 16th April. Likewise, I want to see the rate of 13 May. Like all the days of the moon&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jun 2020 23:39:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180763#M18411</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-24T23:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the moving average of previous 4 weeks sales compared to last week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180866#M18418</link>
      <description>&lt;P&gt;Don't use a date hierarchy in your facts table - use your Dates table for that. The facts table should have just the raw date field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Options and settings, under Current File.. Data load&amp;nbsp; disable the "Auto Date/Time Hierarchy"&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 01:05:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1180866#M18418</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2020-06-25T01:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the moving average of previous 4 weeks sales compared to last week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1182009#M18463</link>
      <description>&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt; &lt;LI-CODE lang="markup"&gt;Perakende Karşılaştırmalı = 
(IF(
    ISFILTERED('Sayfa1'[Date]),
   
        AVERAGEX(
            DATESBETWEEN(
                'Sayfa1'[Date],
                (TODAY()-6),
                (TODAY())
            ),
            CALCULATE(SUM('Sayfa1'[Sales]))
        )
)
)/  
IF(
    ISFILTERED('Sayfa1'[Date]),

        SUMX(
            DATESBETWEEN(
                'Sayfa1'[Date],
                (TODAY()-34),
                (TODAY()-7)
            ),
            CALCULATE(SUM('Sayfa1'[Sales]))
        )/4
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 10:00:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-moving-average-of-previous-4-weeks-sales/m-p/1182009#M18463</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-25T10:00:40Z</dc:date>
    </item>
  </channel>
</rss>

