<?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: Calculate daily number of new, repeat and recovered customers in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2379537#M61445</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;thanks for the links.&lt;/P&gt;&lt;P&gt;For new customer who never made purchase before regarless of period, how would I do that?&lt;/P&gt;&lt;P&gt;I created the following measure, but getting an error saying the resultset of a query to extenal data source has exceeded the maximum allowed sized of 1M rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;NewCustomer = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;FirstOrderDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders[OrderDate]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTROWS&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;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders[email]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;isblank&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;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders&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;vCustomerOrders[OrderDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders[OrderDate]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrderDate&lt;/SPAN&gt;&lt;SPAN&gt;))))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 20:14:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-03-07T20:14:00Z</dc:date>
    <item>
      <title>Calculate daily number of new, repeat and recovered customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2373251#M61000</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on building a report to show number of new, repeat and recovered customers on any given day.&amp;nbsp; I just started using Power BI about a month ago.&amp;nbsp; I'm learning something new everyday, so some asistance woul be greatly appreciated.&amp;nbsp; There are the requirements:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;New&lt;/STRONG&gt;: never made a purchase before&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Repeat&lt;/STRONG&gt;: has made two or more purchases in the last 180 days&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Recovered&lt;/STRONG&gt;: made purchase more than 180 days ago, and came back to make a purchase in the last 180 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a date table and customer order history table that looks like the one below.&amp;nbsp; I'm open to any suggestion and willing to change structure of the order history table if it's neccessary.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am hoping to get:&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;</description>
      <pubDate>Thu, 03 Mar 2022 17:48:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2373251#M61000</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-03T17:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily number of new, repeat and recovered customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2374008#M61048</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt; , check these approaches, in case you need daily, change formula to this day vs last day &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Customer Retention Part 1:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/ba-p/1361529" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-1-Month-on-Month-Retention/ba-p/1361529&lt;/A&gt;&lt;BR /&gt;Customer Retention Part 2: Period over Period Retention :&lt;A href="https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for Day Intelligence - Last day, last non continous day &lt;BR /&gt;&lt;A href="https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c3243d1f9" target="_blank"&gt;https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c3243d1f9&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Customer Retention Part 5: LTD Vs Period Retention&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-5-LTD-and-PeriodYoY-Retention-is-only/ba-p/2114497" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-5-LTD-and-PeriodYoY-Retention-is-only/ba-p/2114497&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2022 03:25:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2374008#M61048</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-03-04T03:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily number of new, repeat and recovered customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2379537#M61445</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;thanks for the links.&lt;/P&gt;&lt;P&gt;For new customer who never made purchase before regarless of period, how would I do that?&lt;/P&gt;&lt;P&gt;I created the following measure, but getting an error saying the resultset of a query to extenal data source has exceeded the maximum allowed sized of 1M rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;NewCustomer = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;FirstOrderDate&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;MIN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders[OrderDate]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTROWS&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;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders[email]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;isblank&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;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders&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;vCustomerOrders[OrderDate]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;vCustomerOrders[OrderDate]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;FirstOrderDate&lt;/SPAN&gt;&lt;SPAN&gt;))))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 20:14:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2379537#M61445</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-07T20:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily number of new, repeat and recovered customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2380677#M61500</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try these Measures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;New =

VAR PurchasedCx =

    CALCULATE (

        DISTINCTCOUNT ( 'Table'[Name] ),

        FILTER ( 'Table', 'Table'[Order Date] &amp;lt;= MAX ( 'date table'[Date] ) )

    )

VAR AllCx =

    CALCULATE ( DISTINCTCOUNT ( 'Table'[Name] ), ALL ( 'Table' ) )

RETURN

    AllCx - purchasedCx&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;
&lt;LI-CODE lang="markup"&gt;Repeat =

VAR PurchsedTable =

    SUMMARIZE (

        VALUES ( 'Table'[Name] ),

        'Table'[Name],

        "OrderNum",

            CALCULATE (

                COUNT ( 'Table'[Order Date] ),

                FILTER (

                    'Table',

                    'Table'[Order Date]

                        &amp;gt;= ( MAX ( 'date table'[Date] ) - 180 )

                        &amp;amp;&amp;amp; 'Table'[Order Date] &amp;lt;= MAX ( 'date table'[Date] )

                )

            )

    )

VAR CountCx =

    COUNTX ( FILTER ( PurchsedTable, [OrderNum] &amp;gt;= 2 ), [Name] )

RETURN

    IF ( ISBLANK ( CountCx ), 0, CountCx )&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;
&lt;LI-CODE lang="markup"&gt;Recovered = 
VAR purchasedCx =
    SUMMARIZE (
        VALUES ( 'Table'[Name] ),
        'Table'[Name],
        "OrderNum",
            CALCULATE (
                COUNT ( 'Table'[Order Date] ),
                FILTER (
                    'Table',
                    'Table'[Order Date]
                        &amp;gt;= ( MAX ( 'date table'[Date] ) - 180 )
                        &amp;amp;&amp;amp; 'Table'[Order Date] &amp;lt;= MAX ( 'date table'[Date] )
                )
            ),
        "OrderMoreThan180Days",
            CALCULATE (
                COUNT ( 'Table'[Order Date] ),
                FILTER ( 'Table', 'Table'[Order Date] &amp;lt; ( MAX ( 'date table'[Date] ) - 180 ) )
            )
    )
VAR CountCX=
    COUNTX (
        FILTER ( purchasedCx, [OrderNum] &amp;gt;= 2 &amp;amp;&amp;amp; [OrderMoreThan180Days] &amp;gt;= 1 ),
        [Name]
    )
RETURN IF(ISBLANK(CountCX),0,CountCX)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, the result should look like this.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, attached the pbix file as reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post helps, then please consider&lt;STRONG&gt; Accept it as the solution&lt;/STRONG&gt; to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!&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 _ Caiyun&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 01:41:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2380677#M61500</guid>
      <dc:creator>v-cazheng-msft</dc:creator>
      <dc:date>2022-03-09T01:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate daily number of new, repeat and recovered customers</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2387533#M61938</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="277465" data-lia-user-login="v-cazheng-msft" class="lia-mention lia-mention-user"&gt;v-cazheng-msft&lt;/a&gt;,&amp;nbsp;thanks for your suggestions.&lt;/P&gt;&lt;P&gt;Sorry I didn't explaining clearly on the definition of repeating customers.&amp;nbsp; It's someone who made a purchase this period (for example, today), and also made two more purchases in the last 180 days.&amp;nbsp; I kinda have it figured out, but running into some performance issue.&amp;nbsp; It runs fine if date range is set to last one year, but anything above that will throw an error about consumed memory exceeding 1024MB limit.&amp;nbsp; Do you mind take a quick check on my code to see if it can be optimized?&amp;nbsp; Greatly appreciated!&amp;nbsp; The vCustomerOrders table has about 1.8 million rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;[Date Repeating Customer]&lt;/STRONG&gt; measure is just:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;min&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DateTable[CalendarDate]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And here is the Repeating Customers measure:&amp;nbsp;&lt;/SPAN&gt;&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;</description>
      <pubDate>Fri, 11 Mar 2022 01:17:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-daily-number-of-new-repeat-and-recovered-customers/m-p/2387533#M61938</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-11T01:17:28Z</dc:date>
    </item>
  </channel>
</rss>

