<?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: how to calculate lost customer distinct count on month level using dax measure in power pivot? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3392537#M127917</link>
    <description>&lt;P&gt;Try adding REMOVEFILTERS('Date') into the CALCULATETABLE calls.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2023 12:43:24 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2023-08-22T12:43:24Z</dc:date>
    <item>
      <title>how to calculate lost customer distinct count on month level using dax measure in power pivot?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3391689#M127863</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I hope you're all doing well. I'm currently working on a project and could use some guidance regarding a DAX measure. I'm trying to calculate distinct counts for different types of customers on a monthly basis, and I'm encountering a few challenges.&lt;/P&gt;&lt;P&gt;Specifically, I'm aiming to determine the following metrics using DAX measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Lost Customer Distinct Count&lt;/STRONG&gt;: The count of customers who were active in the previous month but haven't made any transactions in the current month.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;New Customer Distinct Count&lt;/STRONG&gt;: The count of customers who are making their first transaction in the current month.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Repeat Customer Distinct Count&lt;/STRONG&gt;: The count of customers who have made transactions in both the current month and the previous month.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The database has been loaded into Power Query, and I've successfully established connections in Power Pivot.&lt;/P&gt;&lt;P&gt;Additionally, I'm hoping to enhance this analysis by segmenting the results based on categories and brands, if possible.&lt;/P&gt;&lt;P&gt;If any of you have experience with DAX measures and are willing to lend a helping hand, I would greatly appreciate it. Your expertise could make a significant difference in advancing this project.&lt;/P&gt;&lt;P&gt;Thank you in advance for your support. Looking forward to your insights!&lt;/P&gt;&lt;P&gt;Best regards, Santosh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample database table for reference.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;date&lt;/TD&gt;&lt;TD&gt;customer id&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01 January 2022&lt;/TD&gt;&lt;TD&gt;cust-001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02 January 2022&lt;/TD&gt;&lt;TD&gt;cust-002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03 January 2022&lt;/TD&gt;&lt;TD&gt;cust-003&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01 January 2022&lt;/TD&gt;&lt;TD&gt;cust-001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01 February 2022&lt;/TD&gt;&lt;TD&gt;cust-001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02 February 2022&lt;/TD&gt;&lt;TD&gt;cust-002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;03 February 2022&lt;/TD&gt;&lt;TD&gt;cust-004&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;02 February 2022&lt;/TD&gt;&lt;TD&gt;cust-002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01 March 2022&lt;/TD&gt;&lt;TD&gt;cust-001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01 March 2022&lt;/TD&gt;&lt;TD&gt;cust-002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01 March 2022&lt;/TD&gt;&lt;TD&gt;cust-005&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01 March 2022&lt;/TD&gt;&lt;TD&gt;cust-002&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 22 Aug 2023 06:38:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3391689#M127863</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-22T06:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate lost customer distinct count on month level using dax measure in power pivot?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3392054#M127885</link>
      <description>&lt;P&gt;You could create measures like&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Lost Customers =
VAR CurrentCustomers =
    DISTINCT ( 'Table'[customer id] )
VAR PrevCustomers =
    CALCULATETABLE (
        DISTINCT ( 'Table'[customer id] ),
        DATEADD ( 'Date'[Date], -1, MONTH )
    )
VAR Result =
    COUNTROWS ( EXCEPT ( PrevCustomers, CurrentCustomers ) )
RETURN
    Result

New Customers =
VAR CurrentCustomers =
    DISTINCT ( 'Table'[customer id] )
VAR PrevCustomers =
    CALCULATETABLE (
        DISTINCT ( 'Table'[customer id] ),
        DATEADD ( 'Date'[Date], -1, MONTH )
    )
VAR Result =
    COUNTROWS ( EXCEPT ( CurrentCustomers, PrevCustomers ) )
RETURN
    Result

Repeat Customers =
VAR CurrentCustomers =
    DISTINCT ( 'Table'[customer id] )
VAR PrevCustomers =
    CALCULATETABLE (
        DISTINCT ( 'Table'[customer id] ),
        DATEADD ( 'Date'[Date], -1, MONTH )
    )
VAR Result =
    COUNTROWS ( INTERSECT ( CurrentCustomers, PrevCustomers ) )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 22 Aug 2023 09:01:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3392054#M127885</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-08-22T09:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate lost customer distinct count on month level using dax measure in power pivot?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3392218#M127904</link>
      <description>&lt;P&gt;Thank you so very much for providing me the dax. It works fine on date level when it is being analysed on month level in pivot table the result reflects as zero. Kindly have a look once more. Thanks! once again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 10:20:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3392218#M127904</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-22T10:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to calculate lost customer distinct count on month level using dax measure in power pivot?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3392537#M127917</link>
      <description>&lt;P&gt;Try adding REMOVEFILTERS('Date') into the CALCULATETABLE calls.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 12:43:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-calculate-lost-customer-distinct-count-on-month-level/m-p/3392537#M127917</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-08-22T12:43:24Z</dc:date>
    </item>
  </channel>
</rss>

