<?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: Rolling 26 week with week # in a date table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2565867#M73107</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="388250" data-lia-user-login="OCBB_SFAFPandA" class="lia-mention lia-mention-user"&gt;OCBB_SFAFPandA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create calculated columns like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;year_week = YEAR('Table'[date])*100+WEEKNUM('Table'[date],1)

week_rank = RANKX('Table',[year_week],,ASC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then create the rolling 26 week measure like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rolling_26_week =
SUMX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[week_rank] &amp;lt;= SELECTEDVALUE ( 'Table'[week_rank] )
            &amp;amp;&amp;amp; 'Table'[week_rank]
                &amp;gt; SELECTEDVALUE ( 'Table'[week_rank] ) - 26
    ),
    'Table'[value]
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jay&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jun 2022 08:00:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-06-08T08:00:11Z</dc:date>
    <item>
      <title>Rolling 26 week with week # in a date table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2557523#M72662</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a week number in my date table, which is takes into account leap year. If I want to do a rolling 26 week sales calculation, how would I do that? Most of the articles I see use the DATEADD function, which doesn't include weeks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My weeks always start on sundays, so I can't just have the last 7 days from a Thursday or so. Any suggestions?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 15:51:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2557523#M72662</guid>
      <dc:creator>OCBB_SFAFPandA</dc:creator>
      <dc:date>2022-06-03T15:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 26 week with week # in a date table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2557699#M72676</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="388250" data-lia-user-login="OCBB_SFAFPandA" class="lia-mention lia-mention-user"&gt;OCBB_SFAFPandA&lt;/a&gt; , In you date table have these columns &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new columns &lt;BR /&gt;Week Start date = 'Date'[Date]+-1*WEEKDAY('Date'[Date],2)+1&lt;BR /&gt;Week End date = 'Date'[Date]+ 7-1*WEEKDAY('Date'[Date],2)&lt;BR /&gt;Week Rank = RANKX(all('Date'),'Date'[Week Start date],,ASC,Dense) &lt;BR /&gt;OR&lt;BR /&gt;Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense) //YYYYWW format &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then you can have measures &lt;BR /&gt;This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))&lt;BR /&gt;Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last&amp;nbsp; 26 weeks = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]&amp;gt;=max('Date'[Week Rank])-26 &amp;amp;&amp;amp; 'Date'[Week Rank]&amp;lt;=max('Date'[Week Rank])))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last 26 weeks =&lt;BR /&gt;var _max1 = maxx(allselected('Table'), 'Table'[date]) &lt;BR /&gt;var _max = maxx(filter(all(date), date[date] = _max1), week[Rank])&lt;BR /&gt;return &lt;BR /&gt;CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]&amp;gt;=_max-26 &amp;amp;&amp;amp; 'Date'[Week Rank]&amp;lt;=_max))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 10:50:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2557699#M72676</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-06-03T10:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 26 week with week # in a date table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2558449#M72725</link>
      <description>&lt;P&gt;Thanks Amitchandak!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The rank formula is something i needed, since I don't have access to the data for PQ.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the solution provided able to get the running total?&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;26weekago - 100&lt;/P&gt;&lt;P&gt;25weekago - 350 ( previous + current week)&lt;/P&gt;&lt;P&gt;24weekago - 1000 (previous + current)&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;last week - x&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking to get this time of data on a table&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 17:51:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2558449#M72725</guid>
      <dc:creator>OCBB_SFAFPandA</dc:creator>
      <dc:date>2022-06-03T17:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling 26 week with week # in a date table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2565867#M73107</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="388250" data-lia-user-login="OCBB_SFAFPandA" class="lia-mention lia-mention-user"&gt;OCBB_SFAFPandA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create calculated columns like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;year_week = YEAR('Table'[date])*100+WEEKNUM('Table'[date],1)

week_rank = RANKX('Table',[year_week],,ASC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then create the rolling 26 week measure like below:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rolling_26_week =
SUMX (
    FILTER (
        ALLSELECTED ( 'Table' ),
        'Table'[week_rank] &amp;lt;= SELECTEDVALUE ( 'Table'[week_rank] )
            &amp;amp;&amp;amp; 'Table'[week_rank]
                &amp;gt; SELECTEDVALUE ( 'Table'[week_rank] ) - 26
    ),
    'Table'[value]
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Jay&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2022 08:00:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-26-week-with-week-in-a-date-table/m-p/2565867#M73107</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-08T08:00:11Z</dc:date>
    </item>
  </channel>
</rss>

