<?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 Get last 6 weeks and next 6 weeks data from current date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-last-6-weeks-and-next-6-weeks-data-from-current-date/m-p/3116373#M110357</link>
    <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a huge dataset in a table "Raw" and I am looking create a new table which gives me the data from last 6 weeks and next 6 weeks from current day.&lt;BR /&gt;&lt;BR /&gt;I did write the below code but I am just getting partial rows and not the entire output I am expecting. Can anyone suggest the most efficient approach for this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Last 6 Weeks and Next 6 Weeks = 
VAR CurrentDate = TODAY()
VAR MinDate = MIN(Raw_Salesforce[Close_Date])
VAR MaxDate = MAX(Raw_Salesforce[Close_Date])
RETURN
    FILTER(
        'Raw_Salesforce',
        Raw_Salesforce[Close_Date] &amp;gt;= DATEADD(Raw_Salesforce[Close_Date], -42, DAY) &amp;amp;&amp;amp;
        Raw_Salesforce[Close_Date] &amp;lt;= DATEADD(Raw_Salesforce[Close_Date], 42, DAY) &amp;amp;&amp;amp; 
        Raw_Salesforce[Close_Date]  &amp;gt;= IF(CurrentDate &amp;gt; MaxDate, MaxDate, CurrentDate) - 42 &amp;amp;&amp;amp;
        Raw_Salesforce[Close_Date]  &amp;lt;= IF(CurrentDate &amp;lt; MinDate, MinDate, CurrentDate) + 42 

    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;/P&gt;&lt;P&gt;Praj&lt;/P&gt;</description>
    <pubDate>Tue, 07 Mar 2023 12:55:53 GMT</pubDate>
    <dc:creator>Praj</dc:creator>
    <dc:date>2023-03-07T12:55:53Z</dc:date>
    <item>
      <title>Get last 6 weeks and next 6 weeks data from current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-last-6-weeks-and-next-6-weeks-data-from-current-date/m-p/3116373#M110357</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a huge dataset in a table "Raw" and I am looking create a new table which gives me the data from last 6 weeks and next 6 weeks from current day.&lt;BR /&gt;&lt;BR /&gt;I did write the below code but I am just getting partial rows and not the entire output I am expecting. Can anyone suggest the most efficient approach for this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Last 6 Weeks and Next 6 Weeks = 
VAR CurrentDate = TODAY()
VAR MinDate = MIN(Raw_Salesforce[Close_Date])
VAR MaxDate = MAX(Raw_Salesforce[Close_Date])
RETURN
    FILTER(
        'Raw_Salesforce',
        Raw_Salesforce[Close_Date] &amp;gt;= DATEADD(Raw_Salesforce[Close_Date], -42, DAY) &amp;amp;&amp;amp;
        Raw_Salesforce[Close_Date] &amp;lt;= DATEADD(Raw_Salesforce[Close_Date], 42, DAY) &amp;amp;&amp;amp; 
        Raw_Salesforce[Close_Date]  &amp;gt;= IF(CurrentDate &amp;gt; MaxDate, MaxDate, CurrentDate) - 42 &amp;amp;&amp;amp;
        Raw_Salesforce[Close_Date]  &amp;lt;= IF(CurrentDate &amp;lt; MinDate, MinDate, CurrentDate) + 42 

    )&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;/P&gt;&lt;P&gt;Praj&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2023 12:55:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-last-6-weeks-and-next-6-weeks-data-from-current-date/m-p/3116373#M110357</guid>
      <dc:creator>Praj</dc:creator>
      <dc:date>2023-03-07T12:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get last 6 weeks and next 6 weeks data from current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-last-6-weeks-and-next-6-weeks-data-from-current-date/m-p/3116421#M110365</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="475101" data-lia-user-login="Praj" class="lia-mention lia-mention-user"&gt;Praj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try like:&lt;/P&gt;&lt;DIV&gt;Last 6 Weeks and Next 6 Weeks =&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FILTER(&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Raw_Salesforce,&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;Raw_Salesforce[Close_Date]&amp;gt;=TODAY()-42&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp;&lt;/SPAN&gt;Raw_Salesforce[Close_Date]&amp;lt;=TODAY()+42&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Mar 2023 13:16:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-last-6-weeks-and-next-6-weeks-data-from-current-date/m-p/3116421#M110365</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-03-07T13:16:53Z</dc:date>
    </item>
  </channel>
</rss>

