<?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: Filtering for data 2 weeks prior the current date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2592000#M74686</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;First you need two separate tables, a date table and a fact table. They are not related to each other.&lt;/P&gt;
&lt;P&gt;Then create a measure, like the following.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;Measure =
VAR _selected =
    MAX ( Slicer[Date] )
VAR _start = _selected - 14
RETURN
    IF (
        SELECTEDVALUE ( 'Table'[Date] ) &amp;gt;= _start
            &amp;amp;&amp;amp; SELECTEDVALUE ( 'Table'[Date] ) &amp;lt;= _selected,
        1
    )
&lt;/LI-CODE&gt;
&lt;P&gt;Then put the measure in filter pane and set it show items which is 1.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jun 2022 10:12:01 GMT</pubDate>
    <dc:creator>v-chenwuz-msft</dc:creator>
    <dc:date>2022-06-21T10:12:01Z</dc:date>
    <item>
      <title>Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2586148#M74375</link>
      <description>&lt;P&gt;I am trying to figure out how to filter a date field for 2 weeks prior the current date. The dashboard I am creating has to be completely automated, so using filter where I am selecting a spefic date will not work. This particular dashboard is keeping track of IT Tickets, the field I want to filter for is dateEntered (which is the date the ticket is entered into the system) and I want to show information for tickets opened prior to 2 weeks ago.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The formula I think is closest to my goal is:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;SPAN&gt;DATEADD&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;AllData[dateEntered]&lt;/SPAN&gt;&lt;SPAN&gt;,-&lt;/SPAN&gt;&lt;SPAN&gt;14&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DAY&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and I get the following error on the visual:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 17 Jun 2022 17:10:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2586148#M74375</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-17T17:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2586213#M74378</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How about using the relative date function from the filter pane? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 17:55:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2586213#M74378</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-06-17T17:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2592000#M74686</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;First you need two separate tables, a date table and a fact table. They are not related to each other.&lt;/P&gt;
&lt;P&gt;Then create a measure, like the following.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;Measure =
VAR _selected =
    MAX ( Slicer[Date] )
VAR _start = _selected - 14
RETURN
    IF (
        SELECTEDVALUE ( 'Table'[Date] ) &amp;gt;= _start
            &amp;amp;&amp;amp; SELECTEDVALUE ( 'Table'[Date] ) &amp;lt;= _selected,
        1
    )
&lt;/LI-CODE&gt;
&lt;P&gt;Then put the measure in filter pane and set it show items which is 1.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 10:12:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2592000#M74686</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-06-21T10:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2593199#M74753</link>
      <description>&lt;P&gt;Thank you for the suggestion tomfox, but I need to filter for data that was created prior to 2 weeks ago.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 20:31:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2593199#M74753</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-21T20:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2593433#M74767</link>
      <description>&lt;LI-CODE lang="markup"&gt;14_days_ago =
VAR __LAST_DATE = LASTDATE(DateTable[Date])
VAR __FIRST_DATE = FIRSTDATE(DateTable[Date])
return
AVERAGEX(
    DATESBETWEEN(
        DateTable[Date],
        DATEADD(__FIRST_DATE, -14, DAY),
        DATEADD(__LAST_DATE, -14, DAY)
    ),
    CALCULATE([WHATEVER YOU WANT TO CALCULATE])
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Jun 2022 23:39:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2593433#M74767</guid>
      <dc:creator>vapid128</dc:creator>
      <dc:date>2022-06-21T23:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595076#M74881</link>
      <description>&lt;P&gt;Thank you so much for a quick response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working through this. Is the slicer what effects the date? I have completed all the steps you have shown and the date is not effected by the DAX formula.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 13:24:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595076#M74881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-22T13:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595091#M74882</link>
      <description>&lt;P&gt;What does the CALCULATE at the end of the DAX expression do exactly? Can you giva an example of something to "plug in" there please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 13:28:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595091#M74882</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-22T13:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595657#M74915</link>
      <description>&lt;P&gt;If you have a measure: lines = countrows(table)&lt;/P&gt;&lt;P&gt;in the function, that would be "calculate[lines]" &amp;lt;-- measure name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One more thing, the function is for daily average, if you want daily sum, change&amp;nbsp;AVERAGEX to SUMX.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 17:26:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595657#M74915</guid>
      <dc:creator>vapid128</dc:creator>
      <dc:date>2022-06-22T17:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595716#M74920</link>
      <description>&lt;P&gt;How would you use this to only show the previous 2 weeks from the current date?&amp;nbsp; This is similar to something I need to create a table that will show information for the three years prior. Right now it would show sales total for each month in 2019, but I would the table to update to only show 2020 sales when we get into 2023.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 18:08:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2595716#M74920</guid>
      <dc:creator>AlliedSol_Liz</dc:creator>
      <dc:date>2022-06-22T18:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering for data 2 weeks prior the current date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2596798#M74967</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Works fine with my pbix.&lt;BR /&gt;1 Ensure that the two tables have no relationship&lt;BR /&gt;2 measure is placed in the filter pane of the date table visual&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 07:42:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-for-data-2-weeks-prior-the-current-date/m-p/2596798#M74967</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-06-23T07:42:32Z</dc:date>
    </item>
  </channel>
</rss>

