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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.