<?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: Issue with YTD flag in the case of a leap year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3740866#M145876</link>
    <description>&lt;P&gt;EDATE([date],-12)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You wouldn't believe how much effort went into making that innocent looking function work reliably. It is truly an underappreciated gem.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Mar 2024 19:10:13 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-03-04T19:10:13Z</dc:date>
    <item>
      <title>Issue with YTD flag in the case of a leap year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3739881#M145815</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;A part of my code in my advance editor that builds my calendar table is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;...&lt;BR /&gt;#"Inserted Day of Year" = Table.AddColumn(#"==YTD QTD MTD Columns", "Day of Year", each Date.DayOfYear([Date]), Int64.Type),&lt;BR /&gt;#"Added Flag_YTD" = Table.AddColumn(#"Inserted Day of Year", "Flag_YTD", each if Date.DayOfYear([Date]) &amp;lt;= Date.DayOfYear(CurrentDate)&lt;BR /&gt;then "YTD"&lt;BR /&gt;...&lt;BR /&gt;else null)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and currentdate is defined as&amp;nbsp;&lt;/P&gt;&lt;P&gt;CurrentDate = DateTime.Date(DateTime.FixedLocalNow())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we consider that the date is 4 March 2024, then the YTD flag is true in the case of leap years (i.e. 2024 or 2020) but in the case of standard years (2023, 2022, 2021) it adds also the next day, 5th of March in the calculations of i.e. sales. So I actually do not compare apples to apples since for 2024 the total sales for March incude 1st, 2nd, 3rd and 4th of March but for year 2023 the total sales included 1st, 2nd, 3rd, 4th and 5th of March in the calculation.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we solve this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 11:36:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3739881#M145815</guid>
      <dc:creator>phorfanos</dc:creator>
      <dc:date>2024-03-04T11:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with YTD flag in the case of a leap year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3740866#M145876</link>
      <description>&lt;P&gt;EDATE([date],-12)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You wouldn't believe how much effort went into making that innocent looking function work reliably. It is truly an underappreciated gem.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 19:10:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3740866#M145876</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-04T19:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with YTD flag in the case of a leap year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3742124#M145942</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;thank you for your prompt reply. Could you please be more specific? How will you modify my code? Can I insert the EDATE function in the advance editor?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 07:50:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3742124#M145942</guid>
      <dc:creator>phorfanos</dc:creator>
      <dc:date>2024-03-05T07:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with YTD flag in the case of a leap year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3743070#M145975</link>
      <description>&lt;P&gt;It's a DAX function, not Power Query.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 12:54:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3743070#M145975</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-05T12:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with YTD flag in the case of a leap year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3743122#M145977</link>
      <description>&lt;P&gt;I agree, this is why I asked how we could modify the code in the advanced editor. My objective is to create a column in the Calendar table with the name "flag_YTD" and the use it as a slicer in the reports.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 13:03:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3743122#M145977</guid>
      <dc:creator>phorfanos</dc:creator>
      <dc:date>2024-03-05T13:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with YTD flag in the case of a leap year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3743207#M145980</link>
      <description>&lt;P&gt;As far as I know there is no equivalent function for that in Power Query.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 13:20:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Issue-with-YTD-flag-in-the-case-of-a-leap-year/m-p/3743207#M145980</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-05T13:20:33Z</dc:date>
    </item>
  </channel>
</rss>

