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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Eddie_301177
New Member

How to measure new customer sales

Hi there,

 

I need to show count number of new customers based on the following formula: 0 sales last 13 months, >0 sale last month. Below are my workings so far:

 

1) For all customers:

CountAllCustomer2 = DISTINCTCOUNT(SummarizedQty2[Sold To])
 
2) For loss customers:
CountLossCustomer2 = CALCULATE(DISTINCTCOUNT(SummarizedQty2[Sold To]),SummarizedQty2[Last12MonthQTY]=0)
 
3) For new customer: ????
 
I'm kinda stuck at new customer now. Appreciate your help guys.
2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @Eddie_301177,

 

Can you please try this approach:

CountNewCustomer2 = 
CALCULATE(
    DISTINCTCOUNT(SummarizedQty2[Sold To]),
    FILTER(
        SummarizedQty2,
        CALCULATE(SUM(SummarizedQty2[Quantity]), DATESINPERIOD(SummarizedQty2[Date], MAX(SummarizedQty2[Date]), -13, MONTH)) = 0 &&
        CALCULATE(SUM(SummarizedQty2[Quantity]), DATESINPERIOD(SummarizedQty2[Date], MAX(SummarizedQty2[Date]), -1, MONTH)) > 0
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

One of ways to achieve this is using EXCEPT DAX function in the measure.

FYI, INTERSECT DAX function is also useful when calculating existing customers count.

Jihwan_Kim_1-1736137096130.png

 

 

Jihwan_Kim_0-1736137085041.png

 

EXCEPT function (DAX) - DAX | Microsoft Learn

 

INTERSECT function (DAX) - DAX | Microsoft Learn

 

# New Customers: = 
VAR _untilpreviousmonth =
    EOMONTH ( MAX ( 'calendar'[Date] ), -1 )
VAR _datestart =
    EOMONTH ( _untilpreviousmonth, -13 ) + 1
VAR _existingcustomeruntilpreviousmonthlist =
    CALCULATETABLE (
        SUMMARIZE ( sales, customer[customer_id] ),
        FILTER (
            ALL ( 'calendar' ),
            'calendar'[Date] >= _datestart
                && 'calendar'[Date] <= _untilpreviousmonth
        )
    )
VAR _selectedmonthcustomerslist =
    SUMMARIZE ( sales, customer[customer_id] )
RETURN
    COUNTROWS (
        EXCEPT ( _selectedmonthcustomerslist, _existingcustomeruntilpreviousmonthlist )
    )

 

# existing Customers: = 
VAR _untilpreviousmonth =
    EOMONTH ( MAX ( 'calendar'[Date] ), -1 )
VAR _datestart =
    EOMONTH ( _untilpreviousmonth, -13 ) + 1
VAR _existingcustomeruntilpreviousmonthlist =
    CALCULATETABLE (
        SUMMARIZE ( sales, customer[customer_id] ),
        FILTER (
            ALL ( 'calendar' ),
            'calendar'[Date] >= _datestart
                && 'calendar'[Date] <= _untilpreviousmonth
        )
    )
VAR _selectedmonthcustomerslist =
    SUMMARIZE ( sales, customer[customer_id] )
RETURN
    COUNTROWS (
        INTERSECT( _selectedmonthcustomerslist, _existingcustomeruntilpreviousmonthlist )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5

Try this for New Customer

New Customer Calculation:

  1. Sales in the last 13 months = 0
  2. Sales in the last month > 0

    You can use the CALCULATE function with conditions that filter the data based on these two criteria.

    Here’s the DAX formula to calculate the number of new customers:

    CountNewCustomer2 = CALCULATE(
        DISTINCTCOUNT(SummarizedQty2[Sold To]),
        SummarizedQty2[Last12MonthQTY] = 0,  -- 0 sales in the last 13 months
        SummarizedQty2[LastMonthQTY] > 0     -- >0 sales in the last month
    )
            

Explanation:

  • DISTINCTCOUNT(SummarizedQty2[Sold To]): Counts the distinct customers in the Sold To column.
  • SummarizedQty2[Last12MonthQTY] = 0: Filters customers with no sales in the last 13 months.
  • SummarizedQty2[LastMonthQTY] > 0: Filters customers with more than 0 sales in the last month.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best Regards,
HSathwara.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

One of ways to achieve this is using EXCEPT DAX function in the measure.

FYI, INTERSECT DAX function is also useful when calculating existing customers count.

Jihwan_Kim_1-1736137096130.png

 

 

Jihwan_Kim_0-1736137085041.png

 

EXCEPT function (DAX) - DAX | Microsoft Learn

 

INTERSECT function (DAX) - DAX | Microsoft Learn

 

# New Customers: = 
VAR _untilpreviousmonth =
    EOMONTH ( MAX ( 'calendar'[Date] ), -1 )
VAR _datestart =
    EOMONTH ( _untilpreviousmonth, -13 ) + 1
VAR _existingcustomeruntilpreviousmonthlist =
    CALCULATETABLE (
        SUMMARIZE ( sales, customer[customer_id] ),
        FILTER (
            ALL ( 'calendar' ),
            'calendar'[Date] >= _datestart
                && 'calendar'[Date] <= _untilpreviousmonth
        )
    )
VAR _selectedmonthcustomerslist =
    SUMMARIZE ( sales, customer[customer_id] )
RETURN
    COUNTROWS (
        EXCEPT ( _selectedmonthcustomerslist, _existingcustomeruntilpreviousmonthlist )
    )

 

# existing Customers: = 
VAR _untilpreviousmonth =
    EOMONTH ( MAX ( 'calendar'[Date] ), -1 )
VAR _datestart =
    EOMONTH ( _untilpreviousmonth, -13 ) + 1
VAR _existingcustomeruntilpreviousmonthlist =
    CALCULATETABLE (
        SUMMARIZE ( sales, customer[customer_id] ),
        FILTER (
            ALL ( 'calendar' ),
            'calendar'[Date] >= _datestart
                && 'calendar'[Date] <= _untilpreviousmonth
        )
    )
VAR _selectedmonthcustomerslist =
    SUMMARIZE ( sales, customer[customer_id] )
RETURN
    COUNTROWS (
        INTERSECT( _selectedmonthcustomerslist, _existingcustomeruntilpreviousmonthlist )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Sahir_Maharaj
Super User
Super User

Hello @Eddie_301177,

 

Can you please try this approach:

CountNewCustomer2 = 
CALCULATE(
    DISTINCTCOUNT(SummarizedQty2[Sold To]),
    FILTER(
        SummarizedQty2,
        CALCULATE(SUM(SummarizedQty2[Quantity]), DATESINPERIOD(SummarizedQty2[Date], MAX(SummarizedQty2[Date]), -13, MONTH)) = 0 &&
        CALCULATE(SUM(SummarizedQty2[Quantity]), DATESINPERIOD(SummarizedQty2[Date], MAX(SummarizedQty2[Date]), -1, MONTH)) > 0
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi Sahir,

 

Many thanks for your recommendation. I've booked a 5min slot with you today to better understand this, thanks.

Anonymous
Not applicable

Hi @Eddie_301177 ,

Did the Jihwan_Kim , Sahir_Maharaj's expressions and suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.