<?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: First vs Second purchase Products in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2257406#M54516</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="336681" data-lia-user-login="jmukhtar" class="lia-mention lia-mention-user"&gt;jmukhtar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an option for this.&amp;nbsp; It requires you to import a second copy of your products table that is disconnected from the rest of your model&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then you can have a Second Order Amount measure like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Second Order Amount = 
VAR _Customers =
CALCULATETABLE(
    VALUES('Table'[customer_id]),
    'Table'[sort_order] = 1
)
VAR _Result = 
CALCULATE(
    SUM('Table'[net_sales]),
    'Table'[sort_order] = 2,
    _Customers,
    TREATAS(VALUES('Products 2'[product_name]),'Products'[product_name])
)
RETURN
    _Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, you'd use the product name from Products 2 table in your visual, along with the above measure.&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Dec 2021 21:29:22 GMT</pubDate>
    <dc:creator>PaulOlding</dc:creator>
    <dc:date>2021-12-27T21:29:22Z</dc:date>
    <item>
      <title>First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256495#M54469</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on a requriement to generate visualize what products customer bought in second orders based on products that are purchased in first order and i am really struggling to get this working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a 100 customers bought product A in first order and out of those 100 customers 50 bought Product B and 30 bought Product C and 20 bought Product D in second orders. This neeeds to be presented like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;Data that i currently have looks like this where sortorder is the first or second order number for the customer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&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;We have full control of data and have all of sales and product data available to us and can format data as we require.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried quite a few things but not able to get this working properly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help on how to do it would be really really helpful&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 27 Dec 2021 07:32:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256495#M54469</guid>
      <dc:creator>jmukhtar</dc:creator>
      <dc:date>2021-12-27T07:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256544#M54471</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;&lt;STRONG&gt;Start data:&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Dax (measure):&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FirstOrder = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;Fdate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;calculate&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FIRSTDATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrder[Date]&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;FirstOrder&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrder[Customer]&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;FirstOrder[Customer]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;Sdate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FIRSTDATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrder[Date]&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;FirstOrder&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrder[Date]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;Fdate&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrder[Customer]&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;FirstOrder[Customer]&lt;/SPAN&gt;&lt;SPAN&gt;))&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;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrder[Date]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;switch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;true&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;Cdate&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;Fdate&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"First Order"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Cdate&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;Sdate&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;"Second Order"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Other"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;End result:&lt;BR /&gt;&lt;/STRONG&gt;Note that you need to use filter similar to the one in the picture to get the desired output.&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;I hope this helps and if it does consider accepting this as a solution and giving the post a thumbs up!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 08:08:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256544#M54471</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-27T08:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256669#M54476</link>
      <description>&lt;P&gt;Hi&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This doesn't work for us as we are looking for a list of customers who have bought a specific product in first order and then use that list to see what these customers have bought in second order&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 09:29:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256669#M54476</guid>
      <dc:creator>jmukhtar</dc:creator>
      <dc:date>2021-12-27T09:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256757#M54479</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;In that case you can add this table:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Then you can use that in a table to get the list of customers who bought e.g. Product C in first order:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(add this to table visual ^^)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OrderTypeFilter = &lt;/SPAN&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OR&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;HASONEVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Order Type'[Order Type]&lt;/SPAN&gt;&lt;SPAN&gt;)=&lt;/SPAN&gt;&lt;SPAN&gt;FALSE&lt;/SPAN&gt;&lt;SPAN&gt;(),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Order Type'[Order Type]&lt;/SPAN&gt;&lt;SPAN&gt;)=&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrder&lt;/SPAN&gt;&lt;SPAN&gt;[FirstOrder]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Now edit interactions to disable product filter from second visual:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;BR /&gt;Filter second visual with "second"&lt;BR /&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;And as a result we notice that customers A and B bought product C in the first order. Out of these customers A bought product D in second order.&lt;BR /&gt;&lt;BR /&gt;Data matches this:&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 27 Dec 2021 10:33:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256757#M54479</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2021-12-27T10:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256760#M54480</link>
      <description>&lt;P&gt;It would be helpful if you can attach a Power BI file with some sample data and screenshot of the desired output based on that sample data&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 10:28:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2256760#M54480</guid>
      <dc:creator>askhanduja</dc:creator>
      <dc:date>2021-12-27T10:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2257196#M54508</link>
      <description>&lt;P&gt;Hi&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This solution gives us the first vs the second purchase, but&amp;nbsp;What we want to get in second order visual is only the customers who have purchased from the selected category in first order. Please see the snapshot&amp;nbsp;&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;1,3,6,8,9,10 customers bought product A in first order; and these customers bought product B, C and D in second order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In second visual we want to see products bought by customers who have bought product A in first order&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 17:01:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2257196#M54508</guid>
      <dc:creator>jmukhtar</dc:creator>
      <dc:date>2021-12-27T17:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2257198#M54509</link>
      <description>&lt;P&gt;Sample data is shared along with the requirements. I couldn't get it working on Power BI so far &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 17:02:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2257198#M54509</guid>
      <dc:creator>jmukhtar</dc:creator>
      <dc:date>2021-12-27T17:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2257406#M54516</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="336681" data-lia-user-login="jmukhtar" class="lia-mention lia-mention-user"&gt;jmukhtar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an option for this.&amp;nbsp; It requires you to import a second copy of your products table that is disconnected from the rest of your model&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then you can have a Second Order Amount measure like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Second Order Amount = 
VAR _Customers =
CALCULATETABLE(
    VALUES('Table'[customer_id]),
    'Table'[sort_order] = 1
)
VAR _Result = 
CALCULATE(
    SUM('Table'[net_sales]),
    'Table'[sort_order] = 2,
    _Customers,
    TREATAS(VALUES('Products 2'[product_name]),'Products'[product_name])
)
RETURN
    _Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, you'd use the product name from Products 2 table in your visual, along with the above measure.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Dec 2021 21:29:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2257406#M54516</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2021-12-27T21:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2260465#M54644</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="336681" data-lia-user-login="jmukhtar" class="lia-mention lia-mention-user"&gt;jmukhtar&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have created a data sample,&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;According to this requirement:&amp;nbsp;&lt;U&gt;&lt;EM&gt;we are looking for a list of customers who have bought a specific product in first order and then use that list to see what these customers have bought in second order&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please follow these steps:&lt;/P&gt;
&lt;P&gt;1. Create a productId table for slicer&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ForSlicer = VALUES('Table'[ProducrId])&lt;/LI-CODE&gt;
&lt;P&gt;2. Rank by Date&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = RANKX (ALL('Table'), CALCULATE ( MAX ( ( 'Table'[Date]) ) ),,ASC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;3. First flag measure , and apply it to filter pane, set as "is 1"&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;First = IF(MAX('Table'[ProducrId]) in ALLSELECTED(ForSlicer[ProducrId]),[Rank],BLANK()) &lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;4. Second flag measure, and apply it to filter pane, set as "is 1" as well&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Second = 
var _allCustomers=SUMMARIZE(FILTER(ALL('Table'),[First]=1),[CustomerID])
return IF(MAX('Table'[CustomerID]) in  _allCustomers &amp;amp;&amp;amp; [Rank]=2,1,0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Outputs:&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;Best Regards,&lt;BR /&gt;Eyelyn Qin&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 02:56:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/2260465#M54644</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-12-30T02:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: First vs Second purchase Products</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/4274188#M169570</link>
      <description>&lt;P&gt;Thanks for this approach! I found this easier!&lt;BR /&gt;&lt;BR /&gt;Also, I used this to count distinct customers instead of sales. The only change I did was in the second order measure, I had to include ALL(Table), so that the filters for the first&amp;nbsp; product did not affect this measure.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Second Order Amount = 
VAR _Customers =
CALCULATETABLE(
    VALUES('Table'[customer_id]),
    'Table'[sort_order] = 1
)
VAR _Result = 
CALCULATE(
    SUM('Table'[net_sales]),
    ALL('Table'),
    'Table'[sort_order] = 2,
    _Customers,
    TREATAS(VALUES('Products 2'[product_name]),'Products'[product_name])
)
RETURN
    _Result&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 14:17:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/First-vs-Second-purchase-Products/m-p/4274188#M169570</guid>
      <dc:creator>kk_shp_user</dc:creator>
      <dc:date>2024-11-07T14:17:00Z</dc:date>
    </item>
  </channel>
</rss>

