<?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: Previous Year To Date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3089065#M108115</link>
    <description>&lt;P&gt;H&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2023 00:32:30 GMT</pubDate>
    <dc:creator>Greyesbud</dc:creator>
    <dc:date>2023-02-21T00:32:30Z</dc:date>
    <item>
      <title>Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3079993#M107299</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies as I know this has been asked and answered numerous times before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to get the sales for LY 01/01/2022 to todays date but unsure on how to go about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use CALCULATE(SUM(Transactions[Sales]),SAMEPERIODLASTYEAR(Calendar[Date])) but this just pulls up the full year sales of previous years.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 17:07:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3079993#M107299</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-14T17:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3080034#M107300</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Here is one way to do this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;LY_to_today = &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;LY_Start&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TODAY&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;1&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;return&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&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;'Table (28)'&lt;/SPAN&gt;&lt;SPAN&gt;[value]&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;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;LY_Start&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;TODAY&lt;/SPAN&gt;&lt;SPAN&gt;()))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;end result:&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;
&lt;P&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;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Feb 2023 17:38:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3080034#M107300</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2023-02-14T17:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3080075#M107306</link>
      <description>&lt;P&gt;I am oversimplify so you can follow the DAX and test, but you need to start with wrting some variables.&lt;/P&gt;&lt;P&gt;PreviousYearTodate=&lt;/P&gt;&lt;P&gt;VAR todayYear = Year(Today())&lt;/P&gt;&lt;P&gt;VAR todayMonth= Month(Today())&lt;/P&gt;&lt;P&gt;VAR&amp;nbsp;todayDay = Day(Today())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RETURN CALCULATE(&lt;SPAN&gt;SUM(Transactions[Sales]),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;FILTER(ALL(&lt;SPAN&gt;Calendar),YEAR(Calendar[Date]) =&amp;nbsp;todayYear -1&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;amp;&amp;amp; Month(Calendar[Date]) &amp;lt;=&amp;nbsp;todayMonth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;amp;&amp;amp;&amp;nbsp;Day(Calendar[Date]) &amp;lt;=&amp;nbsp;todayDay )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 18:19:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3080075#M107306</guid>
      <dc:creator>BrianConnelly</dc:creator>
      <dc:date>2023-02-14T18:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3086430#M107916</link>
      <description>&lt;P&gt;hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you need some code to reflect YTD, try like:&lt;/P&gt;&lt;P&gt;CALCULATE(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; SUM(Transactions[Sales]),&lt;BR /&gt;&amp;nbsp; &amp;nbsp; DATESYTD(SAMEPERIODLASTYEAR(Calendar[Date]))&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 08:46:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3086430#M107916</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-02-19T08:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3088185#M108063</link>
      <description>&lt;P&gt;All of the replies were giving me full years value rather than same period for some reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I updated my calendar table which was 2020 - 2029 to 2020 - todays date and this one appeared to be better suited for my needs but still with a slight issue, it rolls up january and full month of february for the previous year rather than 01/01 - 20/02&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Solved it by marking as date table! Thanks &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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 15:29:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3088185#M108063</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-20T15:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3088687#M108100</link>
      <description>&lt;P&gt;Did you test my formula, I specifically made it same period?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;FILTER(ALL(Calendar),YEAR(Calendar[Date]) = todayYear -1

&amp;amp;&amp;amp; Month(Calendar[Date]) &amp;lt;= todayMonth

&amp;amp;&amp;amp; Day(Calendar[Date]) &amp;lt;= todayDay&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 20 Feb 2023 19:12:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3088687#M108100</guid>
      <dc:creator>BrianConnelly</dc:creator>
      <dc:date>2023-02-20T19:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3089065#M108115</link>
      <description>&lt;P&gt;H&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2023 00:32:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3089065#M108115</guid>
      <dc:creator>Greyesbud</dc:creator>
      <dc:date>2023-02-21T00:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3089880#M108200</link>
      <description>&lt;P&gt;Yes, it's pulling up FY, unsure why.&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, 21 Feb 2023 09:24:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3089880#M108200</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-21T09:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3094687#M108523</link>
      <description>&lt;P&gt;Can you show the relationships between the table and the date dimension?&amp;nbsp; It seems you might have a problem there.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 06:43:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3094687#M108523</guid>
      <dc:creator>BrianConnelly</dc:creator>
      <dc:date>2023-02-23T06:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Year To Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3095110#M108563</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Feb 2023 10:29:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Year-To-Date/m-p/3095110#M108563</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-23T10:29:28Z</dc:date>
    </item>
  </channel>
</rss>

