<?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 Find the most recent date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267544#M55041</link>
    <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I'm very new to Power BI and Dax calculations.&amp;nbsp; I know this is likely very simple! The examples I'm finding are more complex than I need and are confusing me more than helping.&amp;nbsp; I'm have two data sources, one is a Reference table of dates (Payment Cycles), the other a list of outgoing payments (Payments).&amp;nbsp; I need to find the date from the Payment table cycle table that is closest to the date in the Payment Cycle table, but is not after it.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a sample of my data:&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;Thank you so much for any tips!&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jan 2022 14:50:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-01-05T14:50:33Z</dc:date>
    <item>
      <title>Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267544#M55041</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;I'm very new to Power BI and Dax calculations.&amp;nbsp; I know this is likely very simple! The examples I'm finding are more complex than I need and are confusing me more than helping.&amp;nbsp; I'm have two data sources, one is a Reference table of dates (Payment Cycles), the other a list of outgoing payments (Payments).&amp;nbsp; I need to find the date from the Payment table cycle table that is closest to the date in the Payment Cycle table, but is not after it.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a sample of my data:&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;Thank you so much for any tips!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 14:50:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267544#M55041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-05T14:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267639#M55049</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Here is one way to do this:&lt;BR /&gt;&lt;BR /&gt;Example data:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dax:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LatestDate = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;Cdate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DateToLook[DateToLook]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&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;DateToGet[DateToGet]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DateToGet[DateToGet]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;DateToGet[DateToGet]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;Cdate&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;End result:&lt;BR /&gt;&lt;/STRONG&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;I hope this helps and if it does consider accepting this as a solution and liking the post!&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Jan 2022 15:28:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267639#M55049</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-01-05T15:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267694#M55054</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; provide sample data and expected output,betetr still provide a sample pbix. uplaod in 1/g drive and share the link here.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 15:47:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267694#M55054</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-05T15:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267807#M55068</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt; here's&amp;nbsp; link to my&amp;nbsp;&amp;nbsp;&lt;A href="https://drive.google.com/drive/folders/1IsYgnncGT3Ht4u2BAJunY3iMscncjDzB" target="_blank" rel="noopener"&gt;Sample Files&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 16:44:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267807#M55068</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-05T16:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267810#M55069</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt; I tried your suggestion but I received the following error message:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;here's&amp;nbsp; link to my&amp;nbsp;&amp;nbsp;&lt;A href="https://drive.google.com/drive/folders/1IsYgnncGT3Ht4u2BAJunY3iMscncjDzB" target="_blank" rel="noopener"&gt;Sample Files&lt;/A&gt;&amp;nbsp;in case this helps.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 16:47:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267810#M55069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-05T16:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267833#M55072</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp; just so I understand, you want to bring the closest&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Payments[Due Date]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to the following table?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PaycycleDates &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 16:55:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267833#M55072</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-05T16:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267865#M55075</link>
      <description>&lt;P&gt;@&lt;SPAN class=""&gt;smpa01&lt;/SPAN&gt;&amp;nbsp;Yes that's correct!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 17:16:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267865#M55075</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-05T17:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267913#M55084</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;The Dax in my example was for a measure. If you place it within a column that type of error might occur due to reason explained here in SQLBI's post:&amp;nbsp;&lt;A href="https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/:" target="_blank"&gt;https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Is it possible to use a measure instead of a column in your model?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 17:36:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267913#M55084</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2022-01-05T17:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267918#M55085</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp; you can use this emasure&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure = 
var _max = MAX(PaycycleDates[Payday])
var _val = CALCULATE(MAX(Payments[Due Date]),FILTER(Payments,Payments[Due Date]&amp;lt;=_max))
return _val&lt;/LI-CODE&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, 05 Jan 2022 17:37:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2267918#M55085</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-05T17:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2270102#M55235</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="24978" data-lia-user-login="smpa01" class="lia-mention lia-mention-user"&gt;smpa01&lt;/a&gt;&amp;nbsp;Thank you.&amp;nbsp; This partrially works.&amp;nbsp; If the date in both tables matches, then it matches perfectly.&amp;nbsp; However, if the date is in the Payment table, but NOT in the Paycycle table, then I would like to find the date closest to the Paycycle date. Currently, it's just left blank.&amp;nbsp; Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 18:24:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2270102#M55235</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-06T18:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Find the most recent date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2270115#M55236</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp; find the attached pbix provided by you and the measure performs as expected, not sure what is the issue here&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jan 2022 18:37:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Find-the-most-recent-date/m-p/2270115#M55236</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2022-01-06T18:37:49Z</dc:date>
    </item>
  </channel>
</rss>

