<?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: How to compare the same period of two different year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3158819#M113372</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've tried the formula but it doesn't work...&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2023 14:59:55 GMT</pubDate>
    <dc:creator>vr83</dc:creator>
    <dc:date>2023-03-28T14:59:55Z</dc:date>
    <item>
      <title>How to compare the same period of two different year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3157828#M113316</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I would like to compare the same period of the current year and the prior year (example YTD march 23 - march 22).&lt;/P&gt;&lt;P&gt;Can I use the function&amp;nbsp;&lt;SPAN&gt;PREVIOUSYEAR?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And how ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advanced.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 07:41:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3157828#M113316</guid>
      <dc:creator>vr83</dc:creator>
      <dc:date>2023-03-28T07:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the same period of two different year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3157875#M113318</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="537368" data-lia-user-login="vr83" class="lia-mention lia-mention-user"&gt;vr83&lt;/a&gt;&amp;nbsp;Hi!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes, you can use the PREVIOUSYEAR function in DAX to compare the same period of the current year and the prior year. Here is an example formula that you can use to achieve this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;YTD Prior Year = &lt;BR /&gt;CALCULATE(&lt;BR /&gt;[Total Sales],&lt;BR /&gt;PREVIOUSYEAR(Dates[Date]) &amp;lt;= Dates[Date] &amp;amp;&amp;amp; &lt;BR /&gt;YEAR(PREVIOUSYEAR(Dates[Date])) = YEAR(MAX(Dates[Date]))&lt;BR /&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The calculation is based on the following conditions:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The date in the previous year must be less than or equal to the current date.&lt;/LI&gt;
&lt;LI&gt;The year of the previous year date must be the same as the year of the latest date in the Dates table.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You will need to replace &lt;CODE&gt;[Total Sales]&lt;/CODE&gt; with your own measure and &lt;CODE&gt;Dates[Date]&lt;/CODE&gt; with your own date column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BBF&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 07:58:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3157875#M113318</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2023-03-28T07:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the same period of two different year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3158181#M113338</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="537368" data-lia-user-login="vr83" class="lia-mention lia-mention-user"&gt;vr83&lt;/a&gt;&amp;nbsp;if the answer is correct, I ask you to accept it as a solution, otherwise I am available for further clarification.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BBF&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 10:23:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3158181#M113338</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2023-03-28T10:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the same period of two different year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3158819#M113372</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've tried the formula but it doesn't work...&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 14:59:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3158819#M113372</guid>
      <dc:creator>vr83</dc:creator>
      <dc:date>2023-03-28T14:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the same period of two different year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3160594#M113489</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;Hi BeaBF,&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;homestly I don't know why it doesn't work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Probably because my record are maybe different.&lt;/SPAN&gt;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in this case how can I write the correct formula using what you've write?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;YTD Prior Year =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;[Total Sales],&lt;BR /&gt;PREVIOUSYEAR(Dates[Date]) &amp;lt;= Dates[Date] &amp;amp;&amp;amp;&lt;BR /&gt;YEAR(PREVIOUSYEAR(Dates[Date])) = YEAR(MAX(Dates[Date]))&lt;BR /&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thansk&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Mar 2023 10:47:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3160594#M113489</guid>
      <dc:creator>vr83</dc:creator>
      <dc:date>2023-03-29T10:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the same period of two different year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3160797#M113505</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="537368" data-lia-user-login="vr83" class="lia-mention lia-mention-user"&gt;vr83&lt;/a&gt;&amp;nbsp; Ok and do you have another column with the YTD? or FY is your YTD?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:30:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3160797#M113505</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2023-03-29T12:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare the same period of two different year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3160824#M113511</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="537368" data-lia-user-login="vr83" class="lia-mention lia-mention-user"&gt;vr83&lt;/a&gt;&amp;nbsp;Firstly, you have to create a column with only the Year and one with only the Month:&lt;/P&gt;
&lt;DIV&gt;&lt;SPAN&gt;YEAR = &lt;/SPAN&gt;&lt;SPAN&gt;LEFT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;[MESI], 4)&lt;BR /&gt;MONTH = RIGHT(Table[MESI], 2)&lt;BR /&gt;then, you can create this measure:&lt;BR /&gt;Delta_YTD =&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;CurrentMonth&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table&lt;/SPAN&gt;&lt;SPAN&gt;[MONTH]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;PrevMonth&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CurrentMonth&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;1&l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IV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Table&lt;/SPAN&gt;&lt;SPAN&gt;[Year]&lt;/SPAN&gt;&lt;SPAN&gt;= CurrentYear&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)) -&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[YTD]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table&lt;/SPAN&gt;&lt;SPAN&gt;),&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Table&lt;/SPAN&gt;&lt;SPAN&gt;[Month]&lt;/SPAN&gt;&lt;SPAN&gt;= Current&lt;/SPAN&gt;&lt;SPAN&gt;Month&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Table&lt;/SPAN&gt;&lt;SPAN&gt;[Year]&lt;/SPAN&gt;&lt;SPAN&gt;= PrevYear&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;SPAN&gt;where YTD is your YTD Value.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;BBF&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Mar 2023 12:41:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-compare-the-same-period-of-two-different-year/m-p/3160824#M113511</guid>
      <dc:creator>BeaBF</dc:creator>
      <dc:date>2023-03-29T12:41:14Z</dc:date>
    </item>
  </channel>
</rss>

