<?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: Last month to date is incorrectly giving the whole previous month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/3145434#M112507</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="153981" data-lia-user-login="vpatel55" class="lia-mention lia-mention-user"&gt;vpatel55&lt;/a&gt;, I thought I came back here but I got it worked out in the end. Thanks for your help.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Mar 2023 17:52:35 GMT</pubDate>
    <dc:creator>shaunb94</dc:creator>
    <dc:date>2023-03-21T17:52:35Z</dc:date>
    <item>
      <title>Last month to date is incorrectly giving the whole previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/1490956#M28654</link>
      <description>&lt;P&gt;My MTD measure correctly shows sales between 1st November to the 11th of November.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&amp;gt; I'm looking to find out what the MTD was the previous month, in the same equivilent period (i.e. 1st October to the 11th of October).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it is returning the whole previous month. Here are measures that I have tried. They all give the same wrong answer (12k).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a calendar table (marked as a date table) and joined to the dates in my fact table.&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;Here are my three attempts:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sales MTD LM (Attempt 1) = 
CALCULATE (
    [Sales],
    DATEADD (
        FILTER ( DATESMTD ( 'Calendar'[Date] ), 'Calendar'[Date] &amp;lt; TODAY () ),
        -1,
        MONTH
    )
)


Sales MTD LM (Attempt 2) = 
CALCULATE ( [Sales MTD], PARALLELPERIOD ( 'Calendar'[Date], -1, MONTH ) )

Sales MTD LM (Attempt 3) = 
CALCULATE ( [Sales MTD], DATEADD ( 'Calendar'[Date], -1, MONTH ) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a video by Curbal to tackle this very problem, and as far as I can tell, I have followed her measure exactly:&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=-xBYtOVyMTs&amp;amp;ab_channel=Curbal" target="_blank"&gt;https://www.youtube.com/watch?v=-xBYtOVyMTs&amp;amp;ab_channel=Curbal&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yet, all attempts are incorrect, giving the whole previous month:&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;Any help would be appreciated.&amp;nbsp; The correct answer should be 4,449 (although if you try it later on, it will of course be higher). Here is the file, containing dummy data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/s/vq8wgwnnl3yk0iv/Sample%20report%201.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/vq8wgwnnl3yk0iv/Sample%20report%201.pbix?dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 17:50:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/1490956#M28654</guid>
      <dc:creator>vpatel55</dc:creator>
      <dc:date>2020-11-12T17:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Last month to date is incorrectly giving the whole previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/1491065#M28660</link>
      <description>&lt;P&gt;I've found the answer, and adding it here in case someone comes across the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The trick is *not* to use the calendar table as the date table. If I use the dates in the fact table, it works fine:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sales MTD LM (Attempt 4) = 
CALCULATE (
    [Sales],
    DATEADD (
        FILTER ( DATESMTD (Data[Date] ), Data[Date]&amp;lt; TODAY () ),
        -1,
        MONTH
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason why I think this is the case, is that the calendar table is marked as a date table, and so it applies an 'ALL' to these time intelligence calculations. So it did not matter what filter I used, it would always select ALL anyway.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 19:19:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/1491065#M28660</guid>
      <dc:creator>vpatel55</dc:creator>
      <dc:date>2020-11-12T19:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Last month to date is incorrectly giving the whole previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/3023891#M103014</link>
      <description>&lt;P&gt;Hey Vpatel, I know this thread is quite a while ago, but your solution does not seem to be working for me as it is still showing the full month rather then MTD. Any ideas what may be up? I have ensured to use the Fact Date table column rather than the Date table one.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 18:05:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/3023891#M103014</guid>
      <dc:creator>shaunb94</dc:creator>
      <dc:date>2023-01-16T18:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Last month to date is incorrectly giving the whole previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/3026769#M103248</link>
      <description>&lt;P&gt;hI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="499787" data-lia-user-login="shaunb94" class="lia-mention lia-mention-user"&gt;shaunb94&lt;/a&gt;&amp;nbsp;I'm afraid I would really need to see the model to see what is going on. I'm busy over the next few days, so it may be worth posting a new question, using a the same model but using dummy data, and hopefully a member of the community can help if I can't.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 19:09:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/3026769#M103248</guid>
      <dc:creator>vpatel55</dc:creator>
      <dc:date>2023-01-17T19:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Last month to date is incorrectly giving the whole previous month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/3145434#M112507</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="153981" data-lia-user-login="vpatel55" class="lia-mention lia-mention-user"&gt;vpatel55&lt;/a&gt;, I thought I came back here but I got it worked out in the end. Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 17:52:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-month-to-date-is-incorrectly-giving-the-whole-previous/m-p/3145434#M112507</guid>
      <dc:creator>shaunb94</dc:creator>
      <dc:date>2023-03-21T17:52:35Z</dc:date>
    </item>
  </channel>
</rss>

