<?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: To **bleep** With STARTOFYEAR in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-bleep-With-STARTOFYEAR/m-p/1781054#M692</link>
    <description>&lt;P&gt;You seem about as angry as I am. I can't believe STARTOFYEAR() requires the actual start of the year to be in the column. This is the problem I had trying to calculate the number of days within the year of a start date;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;As you can see, my data only has Jan 2nd instead of jan1st. This threw off the days in year calculation by 1 day. This has got to be fixed. To *BLEEP* with STARTOFYEAR()! This is rediculous!&lt;/P&gt;</description>
    <pubDate>Mon, 12 Apr 2021 19:52:09 GMT</pubDate>
    <dc:creator>CliffordAP</dc:creator>
    <dc:date>2021-04-12T19:52:09Z</dc:date>
    <item>
      <title>To **bleep** With STARTOFYEAR</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-bleep-With-STARTOFYEAR/m-p/1242820#M569</link>
      <description>&lt;P&gt;Seriously though, all joking aside...what in the world???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway,&amp;nbsp;&lt;SPAN&gt;similar to how I&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Excel-to-DAX-Translation/ba-p/1060991" target="_self"&gt;recreated all of those Excel functions&lt;/A&gt;&lt;SPAN&gt;, my next fun project is unwiding the insanity that is the DAX Time Intelligence Functions. Sure,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/m-p/434008" target="_self"&gt;I started that a long time ago&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;but might as well get specific. This all started with&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/To-bleep-With-STARTOFQUARTER/td-p/1240067" target="_self"&gt;To **bleep** With STARTOFQUARTER&lt;/A&gt;&lt;SPAN&gt;. Here we cover STARTOFYEAR and ENDOFYEAR which are mind bogglingly stupid DAX functions.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ToHellWithSTARTOFMONTH = 
  VAR __Date = MAX('Data'[Date1])
RETURN
  DATE(YEAR(__Date),1,1)&lt;/LI-CODE&gt;
&lt;P&gt;Fail 1 is when you might, quite naturally, think that you should feed the date you are trying to find the start of the year for in as a parameter. Fail.&lt;/P&gt;
&lt;P&gt;Fail 2 is when you pass in the parameter of a date column in a date table but you don't have a relationship with that particular date table that is in context. Fail.&lt;/P&gt;
&lt;P&gt;When it actually works, you have to have a relationship with your date table in context AND pass in the parameter of a date column in that date table. Oh, except that nice blank row that you get... Fail.&lt;/P&gt;
&lt;P&gt;Turns out, in order to get STARTOFYEAR, and most other time intelligence functions, to work you must adhere to the following strict guidelines:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Create a date table with all possible dates for which you might want to find the start of a quarter&lt;/LI&gt;
&lt;LI&gt;Use said date table as the parameter for the STARTOFMONTH function&lt;/LI&gt;
&lt;LI&gt;Ensure that a relationship exists between your fact table and your date table&lt;/LI&gt;
&lt;LI&gt;Ensure that the cardinality of the relationship is such that it is Single from your fact table to your date table&lt;/LI&gt;
&lt;LI&gt;Stand on your head and spin around 3 times while clicking your heels together and singing "&lt;EM&gt;Barbie Girl&lt;/EM&gt;" by Aqua&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;And somehow this is better than just using a DATE statement??? Or, better yet, why not just use the logic encapsulated here and codify it as the function STARTOFYEAR and skip the whole date table thing to begin with? I mean, honestly, where is the value add here folks?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also includes ENDOFYEAR replacement:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ToHellWithENDOFYEAR = 
    VAR __Date = MAX('Data'[Date1])
RETURN
    DATE(YEAR(__Date),12,31)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiOWRjNDhhYTAtZDliNC00YzFlLWI0MTEtMmJmOTZmYzZkYjQ5IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 19:18:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-bleep-With-STARTOFYEAR/m-p/1242820#M569</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-07-22T19:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: To **bleep** With STARTOFYEAR</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-bleep-With-STARTOFYEAR/m-p/1781054#M692</link>
      <description>&lt;P&gt;You seem about as angry as I am. I can't believe STARTOFYEAR() requires the actual start of the year to be in the column. This is the problem I had trying to calculate the number of days within the year of a start date;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;As you can see, my data only has Jan 2nd instead of jan1st. This threw off the days in year calculation by 1 day. This has got to be fixed. To *BLEEP* with STARTOFYEAR()! This is rediculous!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 19:52:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-bleep-With-STARTOFYEAR/m-p/1781054#M692</guid>
      <dc:creator>CliffordAP</dc:creator>
      <dc:date>2021-04-12T19:52:09Z</dc:date>
    </item>
  </channel>
</rss>

