<?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: Date Range based on Slicer selection in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3418572#M129383</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp;. Your solutions provided a cumulative count for the last "X" days, while I was looking to include/exclude days based on the selection. I made it work with the following Measure and by adding a separate Table with just the 'Date' field, which is used as filter.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Measure_last_180_days =&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF (&lt;/SPAN&gt;&lt;SPAN&gt;S&lt;/SPAN&gt;&lt;SPAN&gt;ELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;Date'[&lt;/SPAN&gt;&lt;SPAN&gt;Date])&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;80&lt;/SPAN&gt; &lt;SPAN&gt;&amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;M&lt;/SPAN&gt;&lt;SPAN&gt;AX&lt;/SPAN&gt;&lt;SPAN&gt;( 'Main Table'&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;Date])&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SE&lt;/SPAN&gt;&lt;SPAN&gt;LECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;('&lt;/SPAN&gt;&lt;SPAN&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;ate'[D&lt;/SPAN&gt;&lt;SPAN&gt;ate]) &lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;= &lt;/SPAN&gt;&lt;SPAN&gt;MA&lt;/SPAN&gt;&lt;SPAN&gt;X&lt;/SPAN&gt;&lt;SPAN&gt;('Main Table'&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;Date]),&lt;/SPAN&gt;&lt;SPAN&gt;"y&lt;/SPAN&gt;&lt;SPAN&gt;es"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;n&lt;/SPAN&gt;&lt;SPAN&gt;o"&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 06 Sep 2023 21:36:26 GMT</pubDate>
    <dc:creator>ragnezza</dc:creator>
    <dc:date>2023-09-06T21:36:26Z</dc:date>
    <item>
      <title>Date Range based on Slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3416471#M129280</link>
      <description>&lt;P&gt;Hello - I'm looking to return a list of the previous "X" days based on a selected day from a slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, once a day is selected in the 'Date' slicer, I want to return the date range in the visualization for the &lt;STRONG&gt;previous 180 days up to the selected day&lt;/STRONG&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;In simple words, the logic would be something like the below, but I cannot make it work:&lt;BR /&gt;IF ( Date &amp;gt;= SELECTEDVALUE ( Date )-180 ||&amp;nbsp;Date &amp;lt;= SELECTEDVALUE ( Date ) , Date , blank() )&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then use 'Date' in the visualization and exclude blanks.&lt;/P&gt;&lt;P&gt;Any recommendation is more than welcome, thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 20:39:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3416471#M129280</guid>
      <dc:creator>ragnezza</dc:creator>
      <dc:date>2023-09-05T20:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range based on Slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3416558#M129288</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@&lt;SPAN&gt;ragnezza,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What about using DATESINPERIOD function?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/datesinperiod-function-dax" target="_blank"&gt;DATESINPERIOD function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Something like below is how it can be used:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 22:23:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3416558#M129288</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2023-09-05T22:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range based on Slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3417934#M129350</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp;, this can help as it outputs the [Daily trends] for the previous 180 days, but it doesn't have any relation with the SELECTEDVALUE.&lt;BR /&gt;Below are two examples of how I would like this visualization to show based on the selected dates:&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;thanks!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 14:29:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3417934#M129350</guid>
      <dc:creator>ragnezza</dc:creator>
      <dc:date>2023-09-06T14:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range based on Slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3418448#M129375</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="586100" data-lia-user-login="ragnezza" class="lia-mention lia-mention-user"&gt;ragnezza&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;What about like below?&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;</description>
      <pubDate>Wed, 06 Sep 2023 20:22:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3418448#M129375</guid>
      <dc:creator>DataNinja777</dc:creator>
      <dc:date>2023-09-06T20:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range based on Slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3418572#M129383</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp;. Your solutions provided a cumulative count for the last "X" days, while I was looking to include/exclude days based on the selection. I made it work with the following Measure and by adding a separate Table with just the 'Date' field, which is used as filter.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Measure_last_180_days =&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF (&lt;/SPAN&gt;&lt;SPAN&gt;S&lt;/SPAN&gt;&lt;SPAN&gt;ELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN&gt;Date'[&lt;/SPAN&gt;&lt;SPAN&gt;Date])&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;80&lt;/SPAN&gt; &lt;SPAN&gt;&amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;M&lt;/SPAN&gt;&lt;SPAN&gt;AX&lt;/SPAN&gt;&lt;SPAN&gt;( 'Main Table'&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;Date])&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SE&lt;/SPAN&gt;&lt;SPAN&gt;LECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;('&lt;/SPAN&gt;&lt;SPAN&gt;D&lt;/SPAN&gt;&lt;SPAN&gt;ate'[D&lt;/SPAN&gt;&lt;SPAN&gt;ate]) &lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;= &lt;/SPAN&gt;&lt;SPAN&gt;MA&lt;/SPAN&gt;&lt;SPAN&gt;X&lt;/SPAN&gt;&lt;SPAN&gt;('Main Table'&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;Date]),&lt;/SPAN&gt;&lt;SPAN&gt;"y&lt;/SPAN&gt;&lt;SPAN&gt;es"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;n&lt;/SPAN&gt;&lt;SPAN&gt;o"&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Sep 2023 21:36:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3418572#M129383</guid>
      <dc:creator>ragnezza</dc:creator>
      <dc:date>2023-09-06T21:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range based on Slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3424391#M129693</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="608865" data-lia-user-login="DataNinja777" class="lia-mention lia-mention-user"&gt;DataNinja777&lt;/a&gt;&amp;nbsp;. This can work if I want to have the cumulative "Daily Trends" up to the selected day.&lt;BR /&gt;For this purpose I find this other solution:&lt;BR /&gt;&lt;BR /&gt;Measure =&lt;BR /&gt;if( MAX( 'Main_Table'[Date]) &amp;gt;= SELECTEDVALUE('Date'[Date],min('Date'[Date]) )-180 &amp;amp;&amp;amp;&lt;BR /&gt;MAX( 'Main_Table'[Date]) &amp;lt;= SELECTEDVALUE('Date'[Date],max('Date'[Date]) ),&lt;BR /&gt;"Yes", "No" )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then use this 'Measure' as a filter in the visualization.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 13:28:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3424391#M129693</guid>
      <dc:creator>ragnezza</dc:creator>
      <dc:date>2023-09-11T13:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Date Range based on Slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3457325#M131801</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="586100" data-lia-user-login="ragnezza" class="lia-mention lia-mention-user"&gt;ragnezza&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It seems that you have gotten a solution. Could you please mark the helpful post as &lt;STRONG&gt;&lt;SPAN&gt;Answered&lt;/SPAN&gt;&lt;/STRONG&gt;? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.&lt;/P&gt;
&lt;P&gt;Best Regards&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 09:02:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Date-Range-based-on-Slicer-selection/m-p/3457325#M131801</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-10-03T09:02:49Z</dc:date>
    </item>
  </channel>
</rss>

