<?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: Calculate the previous month value with the same date range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2378282#M61360</link>
    <description>&lt;P&gt;Yeay, great solution!&lt;BR /&gt;Thank you very much, now it works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 09:39:51 GMT</pubDate>
    <dc:creator>bimagty</dc:creator>
    <dc:date>2022-03-07T09:39:51Z</dc:date>
    <item>
      <title>Calculate the previous month value with the same date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2366506#M60586</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have problem with defining dax for calculating the sum of previous month, the conditions:&lt;/P&gt;&lt;P&gt;- This month is February and the data is only available until 19 February, I have calculated this month ongoing sum which is from 1-19 February as &lt;STRONG&gt;&lt;EM&gt;selected month&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;measure.&lt;/P&gt;&lt;P&gt;- I want to calculate the same period in previous month but with the same date range as I have now, i.e. sum of sales &lt;STRONG&gt;1-19 February&lt;/STRONG&gt; vs. sum &lt;STRONG&gt;of 1-19 January.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ive tried to use this formula (shown below), but it calculates the entire sum of sales in January instead of 1-19 January only.&lt;BR /&gt;&lt;BR /&gt;What step do I miss? Really need your help, thanks in advance guys &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 06:59:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2366506#M60586</guid>
      <dc:creator>bimagty</dc:creator>
      <dc:date>2022-03-01T06:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the previous month value with the same date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2366693#M60593</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Try switching the order of your fucntions:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Measure&amp;nbsp; = &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;(&lt;/SPAN&gt;&lt;SPAN&gt;Aggregation[Duration(Secs)]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;datesmtd&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DATEADD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;BR /&gt;&lt;BR /&gt;This will calculate MTD amounts for the previous month (using the same date range).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 08:13:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2366693#M60593</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-03-01T08:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the previous month value with the same date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2366730#M60599</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;Thanks for the reply, but unfortunately I still get the same result as before, it calculates the total of 1 month instead of only selected range of date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;test&lt;/STRONG&gt; &lt;/EM&gt;is the measure following your suggestion, and the &lt;STRONG&gt;&lt;EM&gt;Previous Month Revenue&lt;/EM&gt; &lt;/STRONG&gt;is the total revenue in a full month (January).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 08:22:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2366730#M60599</guid>
      <dc:creator>bimagty</dc:creator>
      <dc:date>2022-03-01T08:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the previous month value with the same date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2374424#M61076</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="362628" data-lia-user-login="bimagty" class="lia-mention lia-mention-user"&gt;bimagty&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try these measures. I attached a sample pbix at bottom.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;This Month = 
VAR _endDate = MAX(Revenues[Date])
VAR _startDate = EOMONTH(_endDate,-1)+1
RETURN
CALCULATE(SUM(Revenues[Revenue]),DATESBETWEEN('Calendar'[Date],_startDate,_endDate))
&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Previous Month = 
VAR _maxDate = MAX(Revenues[Date])
VAR _startDate = EOMONTH(_maxDate,-2) + 1
VAR _endDate = _startDate + DAY(_maxDate) - 1
RETURN
CALCULATE(SUM(Revenues[Revenue]),DATESBETWEEN('Calendar'[Date],_startDate,_endDate))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards, &lt;BR /&gt;Community Support Team _ Jing&lt;BR /&gt;If this post helps, please Accept it as Solution to help other members find it.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 07:51:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2374424#M61076</guid>
      <dc:creator>v-jingzhang</dc:creator>
      <dc:date>2022-03-04T07:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the previous month value with the same date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2378282#M61360</link>
      <description>&lt;P&gt;Yeay, great solution!&lt;BR /&gt;Thank you very much, now it works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 09:39:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2378282#M61360</guid>
      <dc:creator>bimagty</dc:creator>
      <dc:date>2022-03-07T09:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the previous month value with the same date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2657568#M78667</link>
      <description>&lt;P&gt;Great solution&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="254615" data-lia-user-login="v-jingzhang" class="lia-mention lia-mention-user"&gt;v-jingzhang&lt;/a&gt;&amp;nbsp;- this is the best and works for me amongst all the hacks I have gone thru so far on the web.&lt;/P&gt;&lt;P&gt;Really helped me out of a tacky situation!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Jul 2022 16:14:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-the-previous-month-value-with-the-same-date-range/m-p/2657568#M78667</guid>
      <dc:creator>monojchakrab</dc:creator>
      <dc:date>2022-07-24T16:14:49Z</dc:date>
    </item>
  </channel>
</rss>

