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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
H_insight
Helper V
Helper V

New and Recurring Customers

Hello,

I have a sample data that contains 8 columns. What I am trying to do is to identify new customers withing the current reporting month, but my measure is not returning the right outcome.

 

New Customer rule = New sales in the current reporting month only, and not before it. In the below example, If you look at the reporting month in Jan-15, we have 7 records. Of which 4 is new sales only, and the remaining 3 records belong to an old sale (they happened in Dec & Oct 2014 and not Jan 15). “Service Start” column indicates a new sale/service within the reporting month column.

4.png

I tried the below Dax to get the new customers:
New Customers =
VAR
CustomersList = VALUES( Data[ID] )
RETURN
CALCULATE( COUNTROWS( VALUES( Data[ID] ) ),
FILTER(
CustomersList,
CALCULATE( COUNTROWS( Data ),
FILTER( ALLSELECTED( ‘Date’), ‘Date’[Date] < MIN( ‘Date’[Date] ) ) ) = 0 ) )
However, the table outcome was:

3.png

The expected outcome to show how many new customers and values should be:

2.png

 

Sample pbix file

 

Any ideas?

Thanks

 

1 ACCEPTED SOLUTION

@danextian 

 

Thanks for your help on this. I have changed the OldSalesCount to:

OldSalesCount = 
IF (
     EOMONTH(Data[Service Start],0) < EOMONTH(Data[Reporting Month],0),
    0,
    1
)

and the result came as expected.

 

Cheers

View solution in original post

5 REPLIES 5
danextian
Super User
Super User

Hi @H_insight,

If I understand correctly, if the YYYYMMDD of  Service Start < Reporting Date, it is an old sale.  Try these calculated columns

OldSalesCount =
IF (
    VALUE ( FORMAT ( EOMONTH ( 'Table'[Service Start], 0 ), "YYYYMMDD" ) ) < 'Table'[ReportingDate],
    1,
    0
)

 

Customer Status =
VAR OldSalesCount =
    //counts old sales per customer
    CALCULATE (
        SUM ( 'Table'[OldSalesCount] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer Number] )
    )
RETURN
    //if OldSalesCount = 0 then new customer
    IF ( OldSalesCount = 0, "new", "old" )


 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian 

 

Thanks for your help on this. I have changed the OldSalesCount to:

OldSalesCount = 
IF (
     EOMONTH(Data[Service Start],0) < EOMONTH(Data[Reporting Month],0),
    0,
    1
)

and the result came as expected.

 

Cheers

Hi @danextian ,

 

Correct, if the YYYYMMDD of Service Start < Selected Reporting Date then it's an old customer. If YYYYMMDD of Service Start is within the Reporting Date dates, then it's a new customer. Please bear in mind that reporting month will always be the end of the month, so the service started could fall within the month.

 

I have tried your Dax, but unfortunately not the right outcome.

 

The outcome should look like:

2.png

Thanks

nhoward
Resolver I
Resolver I

Hi Hesham,

 

We'll need to know the tables and relationships in your data model before we can help. 

Hi @nhoward ,

 

Here is the PBIX link & the sample file.

 

The sample file holds a simple model of Data (fact) and Date table. Only one relationship between Reporting Month in Data table & Date in Date table.

 

Please let me know if you require any additional information.

 

Thanks

Hesham

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.