<?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: Get User selected dates in date range in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2719438#M82862</link>
    <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="425733" data-lia-user-login="varshajain" class="lia-mention lia-mention-user"&gt;varshajain&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;mindate =
var _minx=MINX(ALLSELECTED('Table'),[Date])
var _maxx=MAXX(ALLSELECTED('Table'),[Date])
return
DATE(YEAR(_minx),MONTH(_minx),1)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;mindate =
var _minx=MINX(ALLSELECTED('Table'),[Date])
var _maxx=MAXX(ALLSELECTED('Table'),[Date])
return
DATE(YEAR(_minx),MONTH(_minx),1)&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you need pbix, please click here.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://m365x97431909-my.sharepoint.com/:u:/g/personal/ly_m365x97431909_onmicrosoft_com/EYFN4j3NFL5PqLWy67rRXfUBvXMKezdXRfGA_nkwJBrZ_A?e=cX0OvE" target="_blank"&gt;&lt;SPAN&gt;Get User selected dates in date range.pbix&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
    <pubDate>Tue, 23 Aug 2022 08:23:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-08-23T08:23:29Z</dc:date>
    <item>
      <title>Get User selected dates in date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2710840#M82332</link>
      <description>&lt;P&gt;I have a DAX function to retrieve teh date range that user has selected&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Dates = &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_max&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;maxx&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;allselected&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Candidates'&lt;/SPAN&gt;&lt;SPAN&gt;[CreateDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'Candidates'&lt;/SPAN&gt;&lt;SPAN&gt;[CreateDate]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_min&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;minx&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;allselected&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Candidates'&lt;/SPAN&gt;&lt;SPAN&gt;[CreateDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;'Candidates'&lt;/SPAN&gt;&lt;SPAN&gt;[CreateDate]&lt;/SPAN&gt;&lt;SPAN&gt;) &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return _min&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;User selected date is &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;I'd like to get 6/1/2022 and 7/31/2022 in my DAX function. However, I notice that with the above DAX I am getting 6/4/2022 as the minimum as the earliest data in my table for this range is dated as 6/4/2022.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to get 6/1/2022 and 7/31/2022 or whatever user selects in that date filter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Aug 2022 20:16:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2710840#M82332</guid>
      <dc:creator>varshajain</dc:creator>
      <dc:date>2022-08-18T20:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Get User selected dates in date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2710896#M82336</link>
      <description>&lt;P&gt;ALLSELECTED is not the right function to use in this context since there's no iteration going on in the visual. This is why it returns the whole column. It is the most complex function in whole DAX and it should be well understood before one can use it. If one doesn't, then please don't. In yur case you should put the whole table as the first argument under min/max to get what you want.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 20:49:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2710896#M82336</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-08-18T20:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Get User selected dates in date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2710913#M82337</link>
      <description>&lt;P&gt;I updated my function to this&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;Dates =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;_max&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;max&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Candidates'&lt;/SPAN&gt;&lt;SPAN&gt;[CreateDate]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;_min&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;min&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Candidates'&lt;/SPAN&gt;&lt;SPAN&gt;[CreateDate]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return _min&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;However, I still the same issue. My expected result is to see 6/1/2022 but it shows 6/4/2022 which happens to be the earliest date for data in table. Also, the _max is returning 7/30/2022 as opposed to 7/31/2022. &lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 18 Aug 2022 20:56:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2710913#M82337</guid>
      <dc:creator>varshajain</dc:creator>
      <dc:date>2022-08-18T20:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Get User selected dates in date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2719438#M82862</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="425733" data-lia-user-login="varshajain" class="lia-mention lia-mention-user"&gt;varshajain&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;mindate =
var _minx=MINX(ALLSELECTED('Table'),[Date])
var _maxx=MAXX(ALLSELECTED('Table'),[Date])
return
DATE(YEAR(_minx),MONTH(_minx),1)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;mindate =
var _minx=MINX(ALLSELECTED('Table'),[Date])
var _maxx=MAXX(ALLSELECTED('Table'),[Date])
return
DATE(YEAR(_minx),MONTH(_minx),1)&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If you need pbix, please click here.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://m365x97431909-my.sharepoint.com/:u:/g/personal/ly_m365x97431909_onmicrosoft_com/EYFN4j3NFL5PqLWy67rRXfUBvXMKezdXRfGA_nkwJBrZ_A?e=cX0OvE" target="_blank"&gt;&lt;SPAN&gt;Get User selected dates in date range.pbix&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 08:23:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2719438#M82862</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-08-23T08:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get User selected dates in date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2720247#M82922</link>
      <description>&lt;P&gt;Thank You for your response. I also did something similar to solve my issue by constructing the date based on month and year&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 12:37:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/2720247#M82922</guid>
      <dc:creator>varshajain</dc:creator>
      <dc:date>2022-08-23T12:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Get User selected dates in date range</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/3445558#M131081</link>
      <description>&lt;P&gt;have you found the solution, I have the same problem&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 09:12:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Get-User-selected-dates-in-date-range/m-p/3445558#M131081</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-09-25T09:12:26Z</dc:date>
    </item>
  </channel>
</rss>

