<?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 Calculated columns for previous weeks values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-columns-for-previous-weeks-values/m-p/3308844#M123636</link>
    <description>&lt;P&gt;Hi guys,&lt;BR /&gt;I have a long table of weekly shares (Share) of several products (SKU) in different regions (Region) as below with the yellow column names. I wish to add 3 calculated columns which present the previous week (-1 WEEK) share of the same product in the same region - same thing for the week before (-2 WEEK) and before that (-3 WEEK).&lt;BR /&gt;&lt;BR /&gt;Please help.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jun 2023 18:36:52 GMT</pubDate>
    <dc:creator>akfir</dc:creator>
    <dc:date>2023-06-29T18:36:52Z</dc:date>
    <item>
      <title>Calculated columns for previous weeks values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-columns-for-previous-weeks-values/m-p/3308844#M123636</link>
      <description>&lt;P&gt;Hi guys,&lt;BR /&gt;I have a long table of weekly shares (Share) of several products (SKU) in different regions (Region) as below with the yellow column names. I wish to add 3 calculated columns which present the previous week (-1 WEEK) share of the same product in the same region - same thing for the week before (-2 WEEK) and before that (-3 WEEK).&lt;BR /&gt;&lt;BR /&gt;Please help.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 18:36:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-columns-for-previous-weeks-values/m-p/3308844#M123636</guid>
      <dc:creator>akfir</dc:creator>
      <dc:date>2023-06-29T18:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated columns for previous weeks values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-columns-for-previous-weeks-values/m-p/3312013#M123850</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="191221" data-lia-user-login="akfir" class="lia-mention lia-mention-user"&gt;akfir&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can try the following methods&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Column:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rankweek = RANKX(FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Region]=EARLIER('Table'[Region])),[Year_Week],,ASC)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;-1 Week = 
Var _week1=MAXX(FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Region]=EARLIER('Table'[Region])&amp;amp;&amp;amp;[Rankweek]&amp;lt;EARLIER('Table'[Rankweek])),[Rankweek])
Return
CALCULATE(SUM('Table'[Share]),FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Region]=EARLIER('Table'[Region])&amp;amp;&amp;amp;[Rankweek]=_week1))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;-2 Week = 
Var _week2=MAXX(FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Region]=EARLIER('Table'[Region])&amp;amp;&amp;amp;[Rankweek]&amp;lt;EARLIER('Table'[Rankweek])-1),[Rankweek])
Return
CALCULATE(SUM('Table'[Share]),FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Region]=EARLIER('Table'[Region])&amp;amp;&amp;amp;[Rankweek]=_week2))&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;-3 Week = 
Var _week3=MAXX(FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Region]=EARLIER('Table'[Region])&amp;amp;&amp;amp;[Rankweek]&amp;lt;EARLIER('Table'[Rankweek])-2),[Rankweek])
Return
CALCULATE(SUM('Table'[Share]),FILTER('Table',[SKU]=EARLIER('Table'[SKU])&amp;amp;&amp;amp;[Region]=EARLIER('Table'[Region])&amp;amp;&amp;amp;[Rankweek]=_week3))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Is this the result you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;helps, then please consider&amp;nbsp;&lt;EM&gt;Accept it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 06:05:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-columns-for-previous-weeks-values/m-p/3312013#M123850</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2023-07-03T06:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculated columns for previous weeks values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-columns-for-previous-weeks-values/m-p/3789355#M148057</link>
      <description>&lt;P&gt;This is the best solution (in my opinion) to fill the column with previous value&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 13:26:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculated-columns-for-previous-weeks-values/m-p/3789355#M148057</guid>
      <dc:creator>Lexporate</dc:creator>
      <dc:date>2024-03-25T13:26:12Z</dc:date>
    </item>
  </channel>
</rss>

