<?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: Getting the latest date based on the selected year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2284661#M55988</link>
    <description>&lt;P&gt;Hi&amp;nbsp; Liu Yang&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your responding, I appreciate it very much.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think we're close. Sorry I made a mistake with my explanation of what I'm trying to do. The table should show "Latest' on the latest date 'assessed' (not 'lodged').&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the table below, the Revision should come up as the latest because it has the latest assesed date (6/24/2021), the other ones should be previous. I tried to use your fomula and just replaced the 'lodged date' with 'assessed date' but I'm still getting 'Latest' for both entry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 15 Jan 2022 02:47:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-01-15T02:47:32Z</dc:date>
    <item>
      <title>Getting the latest date based on the selected year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2262608#M54760</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two date columns, same as the example below.&amp;nbsp;I'm trying to get the latest &lt;STRONG&gt;Date&lt;/STRONG&gt; based on the selected year from my year slicer and show either "Latest" or "Previous".&amp;nbsp;&lt;BR /&gt;My current dax formula is returning "Latest" even though one of dates is obviously not the latest date. below is my formula that I added as a calculated column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Is Latest = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Max_Date&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1[Legal Declaration date]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;Table1[Entity ID]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;EARLIER&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table1[Entity ID]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(Table1&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;Max_Date&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Latest"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Previous"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Is Latest&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Legal Declaration Date&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Latest&lt;/TD&gt;&lt;TD&gt;11/02/2021&lt;/TD&gt;&lt;TD&gt;11/02/2021&lt;/TD&gt;&lt;TD&gt;Reported&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Latest&lt;/TD&gt;&lt;TD&gt;11/06/2021&lt;/TD&gt;&lt;TD&gt;11/02/2021&lt;/TD&gt;&lt;TD&gt;Assessed&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Note: The Date column refers to the reported/assessed date, while the legal declaration date refers to the date when the report was submitted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will appreciate your help on this. Thank you&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jan 2022 00:31:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2262608#M54760</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-02T00:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the latest date based on the selected year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2262688#M54763</link>
      <description>&lt;P&gt;Not 100% sure what you're trying to achieve. Are you able to share a demo pbix file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first thought is you're trying to use a calculated column which is processed when data is loaded and doesn't change values based on a filter context from a slicer.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Jan 2022 09:37:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2262688#M54763</guid>
      <dc:creator>bcdobbs</dc:creator>
      <dc:date>2022-01-02T09:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the latest date based on the selected year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2263087#M54772</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for your immediate response.&amp;nbsp;&lt;BR /&gt;Our data is a bit weird because we have two versions of data in the same table. We have the orginal version and a revision which a company reports within 12 months after the orginal report was submitted.&amp;nbsp;&lt;BR /&gt;I want my table visual to show whether the data is "Latest"or "Previous".&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The dates in the lodged date column and declaration column are often the same but it does vary sometimes when a company makes another revision. In this case the declaration date will remain the same whilst the lodge date will be more recent date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a calculated column which gets the max date in the "Daclaration date" column. And tryign to compare it with the Lodged date column. If the lodged date column is &amp;gt;= declration date then my calculated column will return "Latest"otherwise "Previous".&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'd like to return the "latest" value based on the year selected in the year slicer. My current formula returns the max date for the entire column regardless the year. Therefore, there's no issue when I select the most recent year.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I explained that clearly. Also, here is the &lt;A href="https://drive.google.com/drive/folders/1RqAir7GpPxC7Eh_Xt0uNcYyDRupNbjYS?usp=sharing" target="_self"&gt;link&lt;/A&gt; to the .pbix file and data.&lt;/P&gt;&lt;P&gt;I appreciate whatever advice you can give. Thanks again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 03:36:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2263087#M54772</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-03T03:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the latest date based on the selected year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2264663#M54830</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Anonymous&lt;/LI-USER&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;Ls_latest_measure =
var _select=SELECTEDVALUE('Dates'[Year])
var _seletdate=CALCULATE(MAX('Tbl_Data'[Declaration date]),FILTER(ALL('Tbl_Data'),YEAR('Tbl_Data'[Declaration date])=_select&amp;amp;&amp;amp;'Tbl_Data'[Entity name]=MAX('Tbl_Data'[Entity name])))
return
IF(MAX('Tbl_Data'[Lodged date]) &amp;gt; _seletdate, "Latest" , "Previous" )&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&lt;/P&gt;
&lt;P&gt;According to the slicer selection 2019, the maximum date obtained is 2019-2-13, and the current [Lodged date] is 2020-2-13 and 2020-2-11, both of which are larger than the maximum date obtained, so it is Latest&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&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, 04 Jan 2022 03:15:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2264663#M54830</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-04T03:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the latest date based on the selected year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2284661#M55988</link>
      <description>&lt;P&gt;Hi&amp;nbsp; Liu Yang&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your responding, I appreciate it very much.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think we're close. Sorry I made a mistake with my explanation of what I'm trying to do. The table should show "Latest' on the latest date 'assessed' (not 'lodged').&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the table below, the Revision should come up as the latest because it has the latest assesed date (6/24/2021), the other ones should be previous. I tried to use your fomula and just replaced the 'lodged date' with 'assessed date' but I'm still getting 'Latest' for both entry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jan 2022 02:47:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-latest-date-based-on-the-selected-year/m-p/2284661#M55988</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-15T02:47:32Z</dc:date>
    </item>
  </channel>
</rss>

