<?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: Calculation of Sales between two dates, then calculation of Sales one week ago since this date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-of-Sales-between-two-dates-then-calculation-of-Sales/m-p/2256995#M54491</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Dec 2021 14:33:47 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-12-27T14:33:47Z</dc:date>
    <item>
      <title>Calculation of Sales between two dates, then calculation of Sales one week ago since this date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-of-Sales-between-two-dates-then-calculation-of-Sales/m-p/2256980#M54490</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;My idea is to calculate Sales between two dates in my shops, when special offers for clients started and ended, then I would like to calculate Sales one week ago since this date.&lt;/P&gt;&lt;P&gt;For example, special offers for clients started 15/05/2021 and ended 19/05/2021. I calculated Sales for these periods, then I would like to calculate Sales in these periods between 08/05/2021 and 12-05-2021.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are columns in my table:&lt;/P&gt;&lt;P&gt;A column with Sales [Sales], a column with dates [Date] from 1/01/2021 to 26/12/2021, a column with special offers [Special offers] and a column with dates&amp;nbsp;&lt;SPAN&gt;[DateOfPromotion]&lt;/SPAN&gt; for these special offers (the lenght of the promotion).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I calculated Sales&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sales = sum(Table[Sales])&lt;/P&gt;&lt;P&gt;Therefore, I calculated when my promotion started and ended:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Start Promotion= &lt;/SPAN&gt;&lt;SPAN&gt;min&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table[DateOfPromotion]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End Promotion= &lt;/SPAN&gt;&lt;SPAN&gt;max&lt;/SPAN&gt;&lt;SPAN&gt;(Table[DateOfPromotion]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Then, I calculated Sales between these dates:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales in this promotion= &lt;/SPAN&gt;&lt;SPAN&gt;calculate&lt;/SPAN&gt;&lt;SPAN&gt;(Sales&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Table[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,[Start Promotion]&lt;/SPAN&gt;&lt;SPAN&gt;,[End Promotion]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Next, I calculated Sales between these dates seven days ago&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;First, I calculated date seven days ago from the promotion date:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Start Promotion one week ago= &lt;/SPAN&gt;&lt;SPAN&gt;min&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table[DateOfPromotion]&lt;/SPAN&gt;&lt;SPAN&gt;) - 7&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;End Promotion one week ago= &lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(Table[DateOfPromotion]&lt;/SPAN&gt;&lt;SPAN&gt;) - 7&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Then, I calculated Sales between these dates:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales one week ago= calculate(Sales,DATESBETWEEN([Table[Date],[Start Promotion one week before],[End Promotion one week before]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Finally, I put all measurements in one table, because I would like to compare Sales in this promotion, then Sales one week ago (when it did not take place):&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;As you can see my idea does not work. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried to use Calendar Table, but I obtained the same results.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I was wondering what I did wrongly.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Would you be so kind as to give me your advice how to deal with it properly?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I would apperciate it if you could write your measurement (DAX) with an obvious explanation.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am looking forward to receiving your ideas.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;L. &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 27 Dec 2021 14:26:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-of-Sales-between-two-dates-then-calculation-of-Sales/m-p/2256980#M54490</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-27T14:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of Sales between two dates, then calculation of Sales one week ago since this date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-of-Sales-between-two-dates-then-calculation-of-Sales/m-p/2256995#M54491</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 14:33:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-of-Sales-between-two-dates-then-calculation-of-Sales/m-p/2256995#M54491</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-12-27T14:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of Sales between two dates, then calculation of Sales one week ago since this date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-of-Sales-between-two-dates-then-calculation-of-Sales/m-p/2257024#M54493</link>
      <description>&lt;P&gt;I shared this table output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Is it enough for you ?&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 14:56:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculation-of-Sales-between-two-dates-then-calculation-of-Sales/m-p/2257024#M54493</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-27T14:56:32Z</dc:date>
    </item>
  </channel>
</rss>

