<?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: Max Date of a previous month based on condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2235506#M53389</link>
    <description>&lt;P&gt;Perfect. great job.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Dec 2021 12:21:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-12-13T12:21:48Z</dc:date>
    <item>
      <title>Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2228236#M53129</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I've got a table with a series of months and values, like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer&lt;/TD&gt;&lt;TD&gt;Agreement start date&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Calculated column I want: latest start date where type = new acquisition and customer = same&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;1/6/2020&lt;/TD&gt;&lt;TD&gt;New Aquisition&lt;/TD&gt;&lt;TD&gt;1/1/2021&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1/6/2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Renewal&lt;/TD&gt;&lt;TD&gt;1/1/2022&lt;/TD&gt;&lt;TD&gt;1/6/2020&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;1/6/2022&lt;/TD&gt;&lt;TD&gt;New Acquistion&lt;/TD&gt;&lt;TD&gt;1/1/2023&lt;/TD&gt;&lt;TD&gt;1/6/2022&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1234&lt;/TD&gt;&lt;TD&gt;1/6/2022&lt;/TD&gt;&lt;TD&gt;Renewal&lt;/TD&gt;&lt;TD&gt;1/1/2023&lt;/TD&gt;&lt;TD&gt;1/6/2022&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4414&lt;/TD&gt;&lt;TD&gt;2/7/2022&lt;/TD&gt;&lt;TD&gt;New Acquisition&lt;/TD&gt;&lt;TD&gt;1/1/2023&lt;/TD&gt;&lt;TD&gt;2/7/2022&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It needs a calculated column because I'm trying to make it a matrix, where the rows are the start dates and the columns are the dates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried this, but get a circular dependency:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Last Date = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Current_Date&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;'table'[Agreement Start Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;Current_Name&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;'table'[customer]&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;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;'table'[agreement start date]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'table'[Agreement Start Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;Current_Date&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'table'[customer]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Current_Name&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'table'[type]&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;"New Acquisition"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Do I need to make a new date table for this to work?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 08 Dec 2021 16:12:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2228236#M53129</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-08T16:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2228456#M53135</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp; you can utilize this either as a measure or calculated column&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column = 
VAR _mxCustomer = calculate(MAX(tbl[Customer]))
VAR _mxDate = CALCULATE(MAX(tbl[Agreement start date]),FILTER(ALL(tbl),tbl[Customer]=_mxCustomer&amp;amp;&amp;amp;tbl[Type]="New Acquisition"))
RETURN _mxDate&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pbix is attached&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 18:24:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2228456#M53135</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2021-12-08T18:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2229326#M53162</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Column =
VAR _A =
    FILTER (
        ALL ( 'table' ),
        'table'[Customer] = EARLIER ( 'table'[Customer] )
            &amp;amp;&amp;amp; 'table'[Type] = "New Aquisition"
    )
RETURN
    MAXX ( _A, [Agreement start date] )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;helps&lt;/SPAN&gt;&lt;/STRONG&gt;, please consider&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;accepting&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;it as the solution&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 04:39:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2229326#M53162</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-12-09T04:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2229805#M53176</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In this case, the first two rows are reporting the wrong dates, as the start date for the first row in your custom column is later than the agreement start date of that row.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 08:37:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2229805#M53176</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-09T08:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2229815#M53178</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In this case, the first two rows are reporting the wrong dates, as the start date for the first row in your custom column is later than the agreement start date of that row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if a customer has 2 "New Acquisitions" types, they'll have 2 different start dates.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 08:40:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2229815#M53178</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-09T08:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2231154#M53236</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You said, you want&lt;SPAN&gt;: latest start date where type = new acquisition and customer = same&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;four first rows in the table have the same customer number! so please check your post and update that with new description&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN&gt;Appreciate your Kudos!!&lt;BR /&gt;&lt;STRONG&gt;LinkedIn:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;A href="https://www.linkedin.com/in/vahid-dm/" target="_blank"&gt;www.linkedin.com/in/vahid-dm/&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 20:55:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2231154#M53236</guid>
      <dc:creator>VahidDM</dc:creator>
      <dc:date>2021-12-09T20:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2235323#M53377</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this, create the column&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Test = 
var _latest=CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Customer]=EARLIER('Table'[Customer]) &amp;amp;&amp;amp; 'Table'[Date] &amp;lt;= EARLIER('Table'[Date]) &amp;amp;&amp;amp; 'Table'[Type] = "New Acquisition"))
return  CALCULATE(MAX('Table'[Agreement startate ]),FILTER(ALL('Table'),'Table'[Customer]=EARLIER('Table'[Customer]) &amp;amp;&amp;amp;'Table'[Date]=_latest &amp;amp;&amp;amp; 'Table'[Type] = "New Acquisition"))&lt;/LI-CODE&gt;
&lt;P&gt;result&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Tang&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;, please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 10:20:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2235323#M53377</guid>
      <dc:creator>v-xiaotang</dc:creator>
      <dc:date>2021-12-13T10:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: Max Date of a previous month based on condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2235506#M53389</link>
      <description>&lt;P&gt;Perfect. great job.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Dec 2021 12:21:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Max-Date-of-a-previous-month-based-on-condition/m-p/2235506#M53389</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-13T12:21:48Z</dc:date>
    </item>
  </channel>
</rss>

