<?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 Last date of any selected period in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-of-any-selected-period/m-p/1479679#M28199</link>
    <description>&lt;P&gt;Hello a greeting,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to get the last date of any selected period?&lt;/P&gt;&lt;P&gt;Regardless of whether you select Month, Week, Day, Year, Quarter, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would use this date in a measure that goes against an Inventory Stock table and I want to bring the inventory of the last date of the selected period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the following measures for the week but these measures should work for other periods (Month, Year, etc.):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Inventory Units&lt;/U&gt; = sum ('Stock ABC'[Quantity])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Inventory Units Week =&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;CALCULATE (&lt;U&gt;[Inventory Units]&lt;/U&gt;,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FILTER ('Stock ABC', 'Stock ABC'[Date] = LASTDATE (&lt;EM&gt;Date [SF Weekend]&lt;/EM&gt;)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Date [SF Weekend]&lt;/STRONG&gt;&lt;/EM&gt; is a field in the Date table that has the date of the weekend&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Examples:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If you have a one Slicer per month and I select April that returns April 30&lt;/LI&gt;&lt;LI&gt;If I have a one Slicer per month and I do not select Month that returns the last date&lt;/LI&gt;&lt;LI&gt;If you have one Slicer per Week and select Agu-31 - Sep-06 that returns September 06&lt;/LI&gt;&lt;LI&gt;If I have a Slicer per Week and I do not select Range of the week that the last date returns&lt;/LI&gt;&lt;LI&gt;The same would apply for Year, Quarter, etc.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I have tried to use DATESINPERIOD, DATESBETWEEN, LASTDATE and ISINSCOPE but I don't have much experience with DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Nov 2020 16:38:54 GMT</pubDate>
    <dc:creator>jagutierrezm</dc:creator>
    <dc:date>2020-11-06T16:38:54Z</dc:date>
    <item>
      <title>Last date of any selected period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-of-any-selected-period/m-p/1479679#M28199</link>
      <description>&lt;P&gt;Hello a greeting,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to get the last date of any selected period?&lt;/P&gt;&lt;P&gt;Regardless of whether you select Month, Week, Day, Year, Quarter, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would use this date in a measure that goes against an Inventory Stock table and I want to bring the inventory of the last date of the selected period.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the following measures for the week but these measures should work for other periods (Month, Year, etc.):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Inventory Units&lt;/U&gt; = sum ('Stock ABC'[Quantity])&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Inventory Units Week =&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;CALCULATE (&lt;U&gt;[Inventory Units]&lt;/U&gt;,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;FILTER ('Stock ABC', 'Stock ABC'[Date] = LASTDATE (&lt;EM&gt;Date [SF Weekend]&lt;/EM&gt;)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Date [SF Weekend]&lt;/STRONG&gt;&lt;/EM&gt; is a field in the Date table that has the date of the weekend&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Examples:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;If you have a one Slicer per month and I select April that returns April 30&lt;/LI&gt;&lt;LI&gt;If I have a one Slicer per month and I do not select Month that returns the last date&lt;/LI&gt;&lt;LI&gt;If you have one Slicer per Week and select Agu-31 - Sep-06 that returns September 06&lt;/LI&gt;&lt;LI&gt;If I have a Slicer per Week and I do not select Range of the week that the last date returns&lt;/LI&gt;&lt;LI&gt;The same would apply for Year, Quarter, etc.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I have tried to use DATESINPERIOD, DATESBETWEEN, LASTDATE and ISINSCOPE but I don't have much experience with DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 16:38:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-of-any-selected-period/m-p/1479679#M28199</guid>
      <dc:creator>jagutierrezm</dc:creator>
      <dc:date>2020-11-06T16:38:54Z</dc:date>
    </item>
    <item>
      <title>Re: Last date of any selected period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-of-any-selected-period/m-p/1479703#M28200</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="260887" data-lia-user-login="jagutierrezm" class="lia-mention lia-mention-user"&gt;jagutierrezm&lt;/a&gt; , You have a few options &lt;/P&gt;
&lt;P&gt;your formula seems fine&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;lastnonblankvalue('Stock ABC'[Date],[Inventory Units])
or
Inventory Units Week =
CALCULATE ([Inventory Units],
FILTER ('Stock ABC', 'Stock ABC'[Date] = LASTDATE (Date [SF Weekend])
))
or
Inventory Units Week =
CALCULATE ([Inventory Units],
FILTER ('Stock ABC', 'Stock ABC'[Date] = max(Date [SF Weekend])
))
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 Nov 2020 16:49:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-of-any-selected-period/m-p/1479703#M28200</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-11-06T16:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Last date of any selected period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-of-any-selected-period/m-p/1480104#M28219</link>
      <description>&lt;P&gt;Hello Thanks for the Help, from the options you gave me the first one gave me the correct results with the data that I have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to ask you the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;La medida&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;lastnonblankvalue('Stock ABC'[Date],[Inventory Units])&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;use the field 'Stock ABC' [Date] ==&amp;gt; I have this field hidden in the field list.&lt;/P&gt;&lt;P&gt;I have a table of Dates:&lt;/P&gt;&lt;P&gt;Could you substitute 'Stock ABC' [Date] for 'Date' [Date]?&lt;/P&gt;&lt;P&gt;I did the test and they give me the same results but what would be the best practice?&lt;/P&gt;&lt;P&gt;Always use 'Date' [Date]?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 23:31:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-date-of-any-selected-period/m-p/1480104#M28219</guid>
      <dc:creator>jagutierrezm</dc:creator>
      <dc:date>2020-11-06T23:31:54Z</dc:date>
    </item>
  </channel>
</rss>

