<?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: Return Text Value Based on Client ID and Last Date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/3419069#M129409</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure =&lt;/P&gt;&lt;P&gt;VAR __id = MAX('Table'[ClientID])&lt;/P&gt;&lt;P&gt;VAR __date =&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX('Table'[PurchaseDate]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALLSELECTED('Table'),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Table'[ClientID] = __id&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX('Table'[ItemPurchased]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Table'[ClientID] = __id,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Table'[PurchaseDate] = __date&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;</description>
    <pubDate>Thu, 07 Sep 2023 06:41:47 GMT</pubDate>
    <dc:creator>bbwong</dc:creator>
    <dc:date>2023-09-07T06:41:47Z</dc:date>
    <item>
      <title>Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/1849066#M39482</link>
      <description>&lt;P&gt;Hi All -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have scoured the web looking for an answer on this topic and while there are lots of tutorials/solutions for finding last/max date by customerID (for a purchase, visit, survey taken, etc.), I can't find anything that goes one step further -- and looks at clientID and the last/max date associated with that client ID, then returns the name of that last item purchased or name of the survey they took.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, for example -- sample data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ClientID&amp;nbsp; &amp;nbsp;PurchaseDate&amp;nbsp; ItemPurchased&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/1/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Shirt&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/5/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Pants&lt;/P&gt;&lt;P&gt;456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/11/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Shoes&lt;/P&gt;&lt;P&gt;456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/25/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Book&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to turn the above data into a table that shows the client's last/max/latest purchase date and the item purchased associated with that last date - so, the output would be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Client&amp;nbsp; Last Purchase Date&amp;nbsp; &amp;nbsp;ItemPurchased&lt;/P&gt;&lt;P&gt;123&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/5/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Pants&lt;/P&gt;&lt;P&gt;456&amp;nbsp; &amp;nbsp; &amp;nbsp; 1/25/2021&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Book&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finding the last/max date either via a calc column or measure is no problem, but any help as far as retrieving the actual item purchased associated with that date would be so helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 14:57:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/1849066#M39482</guid>
      <dc:creator>samdep</dc:creator>
      <dc:date>2021-05-18T14:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/1849154#M39485</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="294395" data-lia-user-login="samdep" class="lia-mention lia-mention-user"&gt;samdep&lt;/a&gt; , use this measure for ItemPurchased, if needed take max of date &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure = &lt;BR /&gt;VAR __id = MAX ('Table'[ClientID] )&lt;BR /&gt;VAR __date = CALCULATE ( MAX('Table'[PurchaseDate] ), ALLSELECTED ('Table' ), 'Table'[ClientID] = __id ) &lt;BR /&gt;CALCULATE ( max ('Table'[ItemPurchased] ), VALUES ('Table'[ClientID] ),'Table'[ClientID] = __id,'Table'[PurchaseDate] = __date )&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 15:46:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/1849154#M39485</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-05-18T15:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/1851764#M39566</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;- thank you so much! I have been trying to figure this out for a while now to use within multiple dashboards - and your suggested measure worked perfectly. thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 14:57:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/1851764#M39566</guid>
      <dc:creator>samdep</dc:creator>
      <dc:date>2021-05-19T14:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/2668557#M79494</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This formula is exactly what I need however it keeps telling me the syntax for CALCULATE is incorrect.&lt;BR /&gt;&lt;BR /&gt;Any ideas how to overcome this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 04:45:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/2668557#M79494</guid>
      <dc:creator>bbwong</dc:creator>
      <dc:date>2022-07-29T04:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/2670317#M79605</link>
      <description>&lt;P&gt;Can you share your code, plus some sample data?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 23:48:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/2670317#M79605</guid>
      <dc:creator>samdep</dc:creator>
      <dc:date>2022-07-29T23:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/2671363#M79682</link>
      <description>&lt;P&gt;Hi samdep,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My sample data is:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Client ID&lt;/TD&gt;&lt;TD&gt;Purchase Date&lt;/TD&gt;&lt;TD&gt;ProductName ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4001&lt;/TD&gt;&lt;TD&gt;21/07/2022&lt;/TD&gt;&lt;TD&gt;Pdt ID-199&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4001&lt;/TD&gt;&lt;TD&gt;20/07/2022&lt;/TD&gt;&lt;TD&gt;Pdt ID-200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4001&lt;/TD&gt;&lt;TD&gt;19/07/2022&lt;/TD&gt;&lt;TD&gt;Pdt ID -202&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4001&lt;/TD&gt;&lt;TD&gt;18/07/2022&lt;/TD&gt;&lt;TD&gt;Pdt ID -201&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Client ID&lt;/TD&gt;&lt;TD&gt;Purchase Date&lt;/TD&gt;&lt;TD&gt;ProductName ID&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4001&lt;/TD&gt;&lt;TD&gt;21/07/2022&lt;/TD&gt;&lt;TD&gt;Pdt ID-199&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is:&lt;/P&gt;&lt;P&gt;Measure =&lt;BR /&gt;VAR __id = MAX ('Table'[ClientID] )&lt;BR /&gt;VAR __date = CALCULATE ( MAX('Table'[PurchaseDate] ), ALLSELECTED ('Table' ), 'Table'[ClientID] = __id )&lt;BR /&gt;CALCULATE ( max ('Table'['ProductName ID] ), VALUES ('Table'[ClientID] ),'Table'[ClientID] = __id,'Table'[PurchaseDate] = __date )&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Appreciate your assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jul 2022 22:26:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/2671363#M79682</guid>
      <dc:creator>bbwong</dc:creator>
      <dc:date>2022-07-31T22:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/3417833#M129345</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I also have an similar issue but keep getting an error with the calculate. Did you manage to find a solution for the calculate error? I don't think anyone replied back for a full response to the calculate error in the below measure....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you finally get a solution? Could you share if possible?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advanced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure =&lt;BR /&gt;VAR __id = MAX ('Table'[ClientID] )&lt;BR /&gt;VAR __date = CALCULATE ( MAX('Table'[PurchaseDate] ), ALLSELECTED ('Table' ), 'Table'[ClientID] = __id )&lt;BR /&gt;CALCULATE ( max ('Table'[ItemPurchased] ), VALUES ('Table'[ClientID] ),'Table'[ClientID] = __id,'Table'[PurchaseDate] = __date )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 13:50:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/3417833#M129345</guid>
      <dc:creator>HomerSimpson123</dc:creator>
      <dc:date>2023-09-06T13:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/3417837#M129346</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The measure&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure =&lt;BR /&gt;VAR __id = MAX ('Table'[ClientID] )&lt;BR /&gt;VAR __date = CALCULATE ( MAX('Table'[PurchaseDate] ), ALLSELECTED ('Table' ), 'Table'[ClientID] = __id )&lt;BR /&gt;CALCULATE ( max ('Table'[ItemPurchased] ), VALUES ('Table'[ClientID] ),'Table'[ClientID] = __id,'Table'[PurchaseDate] = __date )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Always shows an error with the calculate - is there something wrong with the above measure where the last calculate shows an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advanced.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 13:51:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/3417837#M129346</guid>
      <dc:creator>HomerSimpson123</dc:creator>
      <dc:date>2023-09-06T13:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Return Text Value Based on Client ID and Last Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/3419069#M129409</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure =&lt;/P&gt;&lt;P&gt;VAR __id = MAX('Table'[ClientID])&lt;/P&gt;&lt;P&gt;VAR __date =&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX('Table'[PurchaseDate]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALLSELECTED('Table'),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Table'[ClientID] = __id&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;RETURN&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX('Table'[ItemPurchased]),&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Table'[ClientID] = __id,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Table'[PurchaseDate] = __date&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; )&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2023 06:41:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Return-Text-Value-Based-on-Client-ID-and-Last-Date/m-p/3419069#M129409</guid>
      <dc:creator>bbwong</dc:creator>
      <dc:date>2023-09-07T06:41:47Z</dc:date>
    </item>
  </channel>
</rss>

