<?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: DATEADD minus 1 year not working in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2430356#M64668</link>
    <description>&lt;P&gt;I have changed the measure to look like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current YTD = TOTALYTD(SUM(POS[POS Net Revenue]),'Calendar'[Calendar Date])&lt;/LI-CODE&gt;&lt;P&gt;and this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Prior YTD = TOTALYTD(SUM(POS[POS Net Revenue]),SAMEPERIODLASTYEAR('Calendar'[Calendar Date]))&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;And I get this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For some reason, it works perfectly for 2021 vs 2020, but no other year&amp;nbsp; works. It starts in month 2 vs month 1 prior year and continues to skip down the rows. The YoY for the entire year remains correct, but not the months.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2022 20:28:20 GMT</pubDate>
    <dc:creator>jwin2424</dc:creator>
    <dc:date>2022-03-31T20:28:20Z</dc:date>
    <item>
      <title>DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2427722#M64526</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get the same calculated measure for the prior year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my first measure, caculating the YTD value of sales:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = CALCULATE (
    SUM ( POS[POS Net Revenue]),
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Calendar Date] &amp;lt;= MAX ( 'Calendar'[Calendar Date])
            &amp;amp;&amp;amp; YEAR ('Calendar'[Calendar Date] ) = YEAR ( MAX ('Calendar'[Calendar Date] ) )
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This returns for me the rolling total from the selected year on my slicer (2021). It also works properly when I select a month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;NOW, all I want to do is the same measure, but for the prior year. When I do this for just the sum of the values using this formula:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure 3 = CALCULATE(sum(POS[POS Net Revenue]), DATEADD('Calendar'[Calendar Date], -1, YEAR))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get these results - which are correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I did the same thing for this measure&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure 2 = 
VAR _CurrentYTD = CALCULATE (
    SUM ( POS[POS Net Revenue]),
    FILTER (
        ALL ( 'Calendar' ),
        'Calendar'[Calendar Date] &amp;lt;= MAX ( 'Calendar'[Calendar Date])
            &amp;amp;&amp;amp; YEAR ('Calendar'[Calendar Date] ) = YEAR ( MAX ('Calendar'[Calendar Date]))
          ))
Return
CALCULATE(_CurrentYTD, DATEADD('Calendar'[Calendar Date], -1, YEAR))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this happens:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;It just gives me the same results, and does not go back a year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong here?!?!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Joe~&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 18:24:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2427722#M64526</guid>
      <dc:creator>jwin2424</dc:creator>
      <dc:date>2022-03-30T18:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2427935#M64551</link>
      <description>&lt;P&gt;I've seen people try this sort of thing before.&amp;nbsp; I think there's a belief that the DAX in the variable acts like a piece of dynamic sql and will recalculate once it's placed inside another DAX statement.&amp;nbsp; However all that happens is that the variable evaluates a specific value and then placing the (now evaluated value) in another DAX statement doesn't alter it, it's already got a value.&lt;/P&gt;
&lt;P&gt;Incidentally, I think the first measure ("measure") is just the same as&amp;nbsp;&lt;/P&gt;
&lt;PRE class=""&gt;&lt;CODE&gt;SUM ( POS[POS Net Revenue])&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That's what it looks like anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Mar 2022 21:04:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2427935#M64551</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2022-03-30T21:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2430356#M64668</link>
      <description>&lt;P&gt;I have changed the measure to look like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Current YTD = TOTALYTD(SUM(POS[POS Net Revenue]),'Calendar'[Calendar Date])&lt;/LI-CODE&gt;&lt;P&gt;and this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Prior YTD = TOTALYTD(SUM(POS[POS Net Revenue]),SAMEPERIODLASTYEAR('Calendar'[Calendar Date]))&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;And I get this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;For some reason, it works perfectly for 2021 vs 2020, but no other year&amp;nbsp; works. It starts in month 2 vs month 1 prior year and continues to skip down the rows. The YoY for the entire year remains correct, but not the months.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 20:28:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2430356#M64668</guid>
      <dc:creator>jwin2424</dc:creator>
      <dc:date>2022-03-31T20:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2431820#M64748</link>
      <description>&lt;P&gt;If you put together a sample pbix and link it here, I'll have a look&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 11:09:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2431820#M64748</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2022-04-01T11:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432615#M64813</link>
      <description>&lt;P&gt;Thank you. Can you walk me through how to do that? I dont see any option in the reply to upload a file.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 16:34:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432615#M64813</guid>
      <dc:creator>jwin2424</dc:creator>
      <dc:date>2022-04-01T16:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432690#M64818</link>
      <description>&lt;P&gt;You'll have to put it on a 3rd party site(box, onedrive etc) and post the link here.&lt;/P&gt;
&lt;P&gt;--&lt;/P&gt;
&lt;P&gt;If you don't want to post it on the forum, send me the link through private message.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 17:22:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432690#M64818</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2022-04-01T17:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432796#M64828</link>
      <description>&lt;P&gt;&lt;A href="https://1drv.ms/u/s!Ar0KGFeE8jBeamtWyVKAtJHjTII?e=KfRK59" target="_blank"&gt;https://1drv.ms/u/s!Ar0KGFeE8jBeamtWyVKAtJHjTII?e=KfRK59&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Let me know if this link works.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have a few formulas in there. I can calculate prior year sales. This aligns with my calendar filters. I can also do YTD and receive a correct sum. When I do prior YTD, it skips the first month. The year is correct, but it is accurate for 10 out of 12 months. My other prior YTD calculation is where I am trying to filter it based on the selected slicer year MINUS 1, and it just returns the current YTD. I am not sure what I am doing wrong here, and it is driving me crazy.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 19:08:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432796#M64828</guid>
      <dc:creator>jwin2424</dc:creator>
      <dc:date>2022-04-01T19:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432840#M64836</link>
      <description>&lt;P&gt;Yes, I got it.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 19:47:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432840#M64836</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2022-04-01T19:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432995#M64848</link>
      <description>&lt;P&gt;When I opened up the calendar table I thought "there must be some conflict between the DAX time intelligence and the fiscal month number". I haven't looked in detail as to what's happening (though I've seen this sort of thing before) but I wrote this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Prior YTDChilli = 
VAR _tYear = MAX('Calendar'[Fiscal Year])
VAR _tMonth = MAX('Calendar'[Month Number])
RETURN
CALCULATE(SUM(POS[Net USD]),
FILTER(ALL('Calendar'), 'Calendar'[Fiscal Year] =  _tYear - 1), 'Calendar'[Month Number] &amp;lt;=  _tMonth)&lt;/LI-CODE&gt;
&lt;P&gt;I removed all time intelligence functions and tried to return what you need.&lt;/P&gt;
&lt;P&gt;Please test at your side.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 00:24:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2432995#M64848</guid>
      <dc:creator>HotChilli</dc:creator>
      <dc:date>2022-04-02T00:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: DATEADD minus 1 year not working</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2433406#M64879</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is exactly right! I could not figure out how to do it without using time intellegnce. It seems like at some point I had to some version of time intellegence.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;BR /&gt;&lt;BR /&gt;On a side note, I would love to know WHY my time intellegence would not work for prior year but would work for current year. I am guessing it has something to do with DAX trying to calculate based on calendar date 1 through 31 even though I am filtering on fiscal month and year. I also don't know if I need to turn off auto calendar in the settings. I did change my table to the date table, but I know DAX still uses the default calendar for time intellegence.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Lastly, I don't know how the MAX function operates. I was trying those filters as well, but it kept returning the current date. I just didn't use the MAX function. I tried just filtering by fiscal year - 1. Knowing might help me greatly in any other time intellegence functions I try with our weird company fiscal calendar.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;THANK YOU!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Apr 2022 20:47:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DATEADD-minus-1-year-not-working/m-p/2433406#M64879</guid>
      <dc:creator>jwin2424</dc:creator>
      <dc:date>2022-04-02T20:47:44Z</dc:date>
    </item>
  </channel>
</rss>

