Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Martijn1204
Frequent Visitor

Defining new customer

Hi all,

 

I am a bit stuck with a difficult DAX function and I just can't get my head around it so maybe you guys can help me.

 

I want to define new customers and old customers, starting from the year 2020.

New customer = When a customer is in the first 12 months of its first purchase. So, customer buys in January 2020 and in the following 12 months this customer is categorized as a "new customer"

Old customer = When a customer is still making purchases after the 12 months prior.

 

I already made the following command but this is only categorizing the new customers as customers who haven't bought anything in the months prior. However, when they did their first purchase in January, they are not a new customer in the following months.

 

Newly customers =

VAR currentcustomers = VALUES(ClientRevenueProfitByService_v5[ClientNameConsolidated])
VAR currentdate = MIN('Date'[Date])
VAR pastcustomers = CALCULATETABLE(VALUES(ClientRevenueProfitByService_v5[ClientNameConsolidated]),ALL('Date'[Date].[Month],'Date'[Date].[MonthNo],'Date'[Date].[Year]),'Date'[Date] < currentdate)
VAR NEWcustomers = EXCEPT(currentcustomers, pastcustomers)

Return COUNTROWS(Newcustomers)

 

I hope you guys can help me on this

1 ACCEPTED SOLUTION

8 REPLIES 8
v-jialluo-msft
Community Support
Community Support

Hi, @Martijn1204 ;
Please follow these steps:
(1)This is my test data :

vjialluomsft_2-1666947649963.png

(2) Create a measure to count the new customer

 

CountNewCustomer = 
VAR _old =
    SUMMARIZE (
        FILTER (
            'ClientRevenueProfitByService_v5',
            'ClientRevenueProfitByService_v5'[Date] <= EDATE ( TODAY (), -12 )
                && 'ClientRevenueProfitByService_v5'[Sales] <> BLANK ()
        ),
        'ClientRevenueProfitByService_v5'[ClientNameConsolidated]
    )
VAR _new =
    SUMMARIZE (
        FILTER (
            'ClientRevenueProfitByService_v5',
            'ClientRevenueProfitByService_v5'[Date] > EDATE ( TODAY (), -12 )
        ),
        'ClientRevenueProfitByService_v5'[ClientNameConsolidated]
    )
RETURN
    COUNTROWS ( EXCEPT ( _new, _old ) )

 

(3) The result is as follows :

vjialluomsft_3-1666947702804.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Gallen Luo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DimaMD
Solution Sage
Solution Sage

Hi, @Martijn1204  You can read this article here, it is well described how to identify new customers
https://www.daxpatterns.com/new-and-returning-customers/


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Hi,

 

I also found this article but I can't find that they define "new customers" as customers who purchased something in the first 12 months of their purchase. I now how to define "new customers" as customers who purchased something for the first time in month A. And when it is month B, these customers aren't defined as "new customers".

daXtreme
Solution Sage
Solution Sage

The definitions are flawed.

 


I want to define new customers and old customers, starting from the year 2020.

New customer = When a customer is in the first 12 months of its first purchase. So, customer buys in January 2020 and in the following 12 months this customer is categorized as a "new customer"

Old customer = When a customer is still making purchases after the 12 months prior.


When a customer made their first purchase on day A, month B, then regardless of what the customer had been doing in the next 11 months, they are classified as "new" in the very next 11 months (plus the month on which they made their first purchase, of course). What happens after the 11th month after the purchase? What is the classification? Does it depend on whether the customer has made a purchase after the 11th month or not? If they did, then they are "old" and if not, they're still "new" or already "old"? It's not clear.

Hi,

After the 11th months after their first purchase they move to the category "Old customers". It does not matter if they made a purchase after the 11 months. A new customer moves to the category "Old customer" after 11 months no matter what. If they bought something in the 10th month, they are categorised as "new customer", and if the next time that they buy something is 3 months after the 10th month, they are categorised as "old customer".

 

Hope this makes it more clear.  

Yeah... I think I now do understand the logic. Thanks for clarification. By the way, is it possible for you to give us some kind of data representative of your problem to work with? If so, please place a link to the file here.

File attached.

Hi,

Thankyou alot, this really helps.

Apologies for the late reaction as I had to tackle some urgent projects.

This is exactly what I needed but there is an exception. 

 

If their first purchase was on 01/01/2000, they are a "new customer" until 01/01/2001 (period of 12 months). But if they haven't bought anything in the upcoming 12 months, so from 01/01/2001 till 01/01/2002. They switch from "new customer" to "support customer". Do you think this is also possible?

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.