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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
carolinefer
Helper I
Helper I

Formula to calculate New customer does not work

Hello All, 

 

I have created some formulas to identify the number of new customers and those that got reactivated. 

In my logic, I created a months since first purchase to be able to find those that are new which would be months since first purchase = 0. However, it seems this formula is not working and I am not able to find what is the reason. 

 

MOnths since last purchase = DATEDIFF([MIn date],[Max date], MONTH)
 
Max date =
VAR CurrentName = SELECTEDVALUE(TotalBilled[customer_id])
RETURN
MAXX(
FILTER(TotalBilled,TotalBilled[customer_id]=CurrentName),
TotalBilled[Date])
 
MIn date =
VAR CurrentName = SELECTEDVALUE(TotalBilled[customer_id])
RETURN
MINX(
FILTER(TotalBilled,TotalBilled[customer_id]=CurrentName),
TotalBilled[Date])
 
New = SUMX(
VALUES('DimCustomer'[customer_id]),
IF(ISBLANK([Prior MRR])&&NOT(ISBLANK([Current MRR]))&&[Days since last purchase]=0,[Current MRR],BLANK()))
 
Current MRR = sum(TotalBilled[amount_usd])
 
Prior MRR = CALCULATE(
SUM(TotalBilled[amount_usd]),
DATEADD( DimCalendar[FullDateAlternateKey], -1, month)
)
 
Reactivated =
SUMX(
VALUES('DimCustomer'[customer_id]),
IF(ISBLANK([Prior MRR])&&NOT(ISBLANK([Current MRR]))&&[Days since last purchase]>0,[Current MRR],BLANK()))
 
 

This is the sample file: https://drive.google.com/file/d/1OnDkfejfe2ow-vJoVdgANZYuSCG7-_-n/view?usp=sharing 

 

Thank you so much in advance

 

1 ACCEPTED SOLUTION
ebeery
Solution Sage
Solution Sage

@carolinefer I would highly recommend you start by referencing the "New and Returning Customers" DAX patterns, which have been outlined by sqlbi .


https://www.daxpatterns.com/new-and-returning-customers/ 

View solution in original post

1 REPLY 1
ebeery
Solution Sage
Solution Sage

@carolinefer I would highly recommend you start by referencing the "New and Returning Customers" DAX patterns, which have been outlined by sqlbi .


https://www.daxpatterns.com/new-and-returning-customers/ 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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