<?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 Week Starting in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Week-Starting/m-p/391487#M123</link>
    <description>&lt;P&gt;Produce a user friendly week identifier such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;W12 Week Starting 3/25/2018&lt;/P&gt;
&lt;P&gt;W13 Week &lt;SPAN&gt;Starting &lt;/SPAN&gt;3/30/2018&lt;/P&gt;
&lt;P&gt;W14 Week &lt;SPAN&gt;Starting &lt;/SPAN&gt;4/8/2018&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the PBIX makes slight improvements to Week Ending: &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Week-Ending/m-p/389293" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Week-Ending/m-p/389293&lt;/A&gt; to remove hard-coded date values from temporary calendar table and clean up some extraneous CALCULATE functions. PBIX also includes column versions of both measures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;mWeekStarting = &lt;BR /&gt;//Get information about the current date&lt;BR /&gt;VAR myDate = MAX(Calender[Date])&lt;BR /&gt;VAR myWeekNum = WEEKNUM(myDate)&lt;BR /&gt;VAR myYear = YEAR(myDate)&lt;BR /&gt;//Set min and max for Calendar table&lt;BR /&gt;VAR minDate = CALCULATE(MIN(Calender[Date]),ALL(Calender))&lt;BR /&gt;VAR maxDate = CALCULATE(MAX(Calender[Date]),ALL(Calender))&lt;BR /&gt;//Create calendar table and add required columns&lt;BR /&gt;VAR dateTable = CALENDAR(minDate,maxDate)&lt;BR /&gt;VAR dateTable1 = ADDCOLUMNS(dateTable,"WeekNum",WEEKNUM([Date]))&lt;BR /&gt;VAR dateTable2 = ADDCOLUMNS(dateTable1,"WeekDay",WEEKDAY([Date]))&lt;BR /&gt;//Return date that matches the current year and weeknum and is a week day of 1 (Sunday)&lt;BR /&gt;VAR weekStartDate = MINX(FILTER(dateTable2,YEAR([Date])=myYear&amp;amp;&amp;amp;[WeekNum]=myWeekNum&amp;amp;&amp;amp;[WeekDay]=1),[Date])&lt;BR /&gt;//If null, then it is at the end of the year and the week starts last year - there may be 53 weeks that year&lt;BR /&gt;VAR weekStartDate1 = IF(NOT(ISBLANK(weekStartDate)),weekStartDate,MINX(FILTER(dateTable2,YEAR([Date])=myYear-1&amp;amp;&amp;amp;[WeekNum]=53&amp;amp;&amp;amp;[WeekDay]=1),[Date]))&lt;BR /&gt;//If null, then it is at the end of the year and the week starts last year - there may not be 53 weeks that year&lt;BR /&gt;VAR weekStartDate2 = IF(NOT(ISBLANK(weekStartDate1)),weekStartDate1,MINX(FILTER(dateTable2,YEAR([Date])=myYear-1&amp;amp;&amp;amp;[WeekNum]=52&amp;amp;&amp;amp;[WeekDay]=1),[Date]))&lt;BR /&gt;//If it is still null, then it is at the start of our calendar table&lt;BR /&gt;VAR weekStartDate3 = IF(NOT(ISBLANK(weekStartDate2)),weekStartDate2,MINX(dateTable2,[Date]))&lt;BR /&gt;//Return a nicely formatted week ending format "W# Week Ending mm/dd/yyyy"&lt;BR /&gt;RETURN "W" &amp;amp; myWeekNum &amp;amp; " Week Starting " &amp;amp; weekStartDate3&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiNDEwY2M1ZmYtYjM5ZC00NDkwLTliMjEtMjVkNmMyMzhlODRlIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jun 2018 18:10:28 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2018-06-27T18:10:28Z</dc:date>
    <item>
      <title>Week Starting</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Week-Starting/m-p/391487#M123</link>
      <description>&lt;P&gt;Produce a user friendly week identifier such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;W12 Week Starting 3/25/2018&lt;/P&gt;
&lt;P&gt;W13 Week &lt;SPAN&gt;Starting &lt;/SPAN&gt;3/30/2018&lt;/P&gt;
&lt;P&gt;W14 Week &lt;SPAN&gt;Starting &lt;/SPAN&gt;4/8/2018&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the PBIX makes slight improvements to Week Ending: &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Week-Ending/m-p/389293" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Week-Ending/m-p/389293&lt;/A&gt; to remove hard-coded date values from temporary calendar table and clean up some extraneous CALCULATE functions. PBIX also includes column versions of both measures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;mWeekStarting = &lt;BR /&gt;//Get information about the current date&lt;BR /&gt;VAR myDate = MAX(Calender[Date])&lt;BR /&gt;VAR myWeekNum = WEEKNUM(myDate)&lt;BR /&gt;VAR myYear = YEAR(myDate)&lt;BR /&gt;//Set min and max for Calendar table&lt;BR /&gt;VAR minDate = CALCULATE(MIN(Calender[Date]),ALL(Calender))&lt;BR /&gt;VAR maxDate = CALCULATE(MAX(Calender[Date]),ALL(Calender))&lt;BR /&gt;//Create calendar table and add required columns&lt;BR /&gt;VAR dateTable = CALENDAR(minDate,maxDate)&lt;BR /&gt;VAR dateTable1 = ADDCOLUMNS(dateTable,"WeekNum",WEEKNUM([Date]))&lt;BR /&gt;VAR dateTable2 = ADDCOLUMNS(dateTable1,"WeekDay",WEEKDAY([Date]))&lt;BR /&gt;//Return date that matches the current year and weeknum and is a week day of 1 (Sunday)&lt;BR /&gt;VAR weekStartDate = MINX(FILTER(dateTable2,YEAR([Date])=myYear&amp;amp;&amp;amp;[WeekNum]=myWeekNum&amp;amp;&amp;amp;[WeekDay]=1),[Date])&lt;BR /&gt;//If null, then it is at the end of the year and the week starts last year - there may be 53 weeks that year&lt;BR /&gt;VAR weekStartDate1 = IF(NOT(ISBLANK(weekStartDate)),weekStartDate,MINX(FILTER(dateTable2,YEAR([Date])=myYear-1&amp;amp;&amp;amp;[WeekNum]=53&amp;amp;&amp;amp;[WeekDay]=1),[Date]))&lt;BR /&gt;//If null, then it is at the end of the year and the week starts last year - there may not be 53 weeks that year&lt;BR /&gt;VAR weekStartDate2 = IF(NOT(ISBLANK(weekStartDate1)),weekStartDate1,MINX(FILTER(dateTable2,YEAR([Date])=myYear-1&amp;amp;&amp;amp;[WeekNum]=52&amp;amp;&amp;amp;[WeekDay]=1),[Date]))&lt;BR /&gt;//If it is still null, then it is at the start of our calendar table&lt;BR /&gt;VAR weekStartDate3 = IF(NOT(ISBLANK(weekStartDate2)),weekStartDate2,MINX(dateTable2,[Date]))&lt;BR /&gt;//Return a nicely formatted week ending format "W# Week Ending mm/dd/yyyy"&lt;BR /&gt;RETURN "W" &amp;amp; myWeekNum &amp;amp; " Week Starting " &amp;amp; weekStartDate3&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiNDEwY2M1ZmYtYjM5ZC00NDkwLTliMjEtMjVkNmMyMzhlODRlIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 18:10:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Week-Starting/m-p/391487#M123</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2018-06-27T18:10:28Z</dc:date>
    </item>
  </channel>
</rss>

