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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Distinct New Customer measure

Hi Everyone, 

 

I have some difficulties find it the right measure for my new customer metrics : 

 

I have 3 tables in my model : 

1 - Orders 

2 - Customers

3- Calendar ( date table)

 

I want to create a table that shows all new customers per month and year so i used the following measure : 

 

New Customers =
COUNTROWS (
FILTER (
ADDCOLUMNS (
VALUES ( Customers[ID] ),
"PreviousSales",
CALCULATE (
COUNTROWS ( Orders),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] < MIN ( 'Calendar'[Date] )
)
)
),
ISBLANK ( [PreviousSales] )
)
)
 
It works but if i have a new customer that bought twice in the same month, the measure count it twice too. I thought of making another measure where i substract the repeate purchases but it doesnt work. 
 
 
Maybe someone know how to delete those duplicate ? 
 
 
Thank you in advance !
 
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Please use Orders[ID] instead of Customers[ID]

 

New Customers = 
COUNTROWS (
FILTER (
ADDCOLUMNS (
VALUES ( Orders[ID] ),
"PreviousSales",
CALCULATE (
COUNTROWS ( Orders),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] < MIN ( 'Calendar'[Date] )
)
)
),
ISBLANK ( [PreviousSales] )
)
)

 

 

Or you could try other methods

https://finance-bi.com/power-bi-new-and-repeat-customers/

https://www.sqlbi.com/articles/computing-new-customers-in-dax/

 

Best Regards

Maggie

View solution in original post

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Please use Orders[ID] instead of Customers[ID]

 

New Customers = 
COUNTROWS (
FILTER (
ADDCOLUMNS (
VALUES ( Orders[ID] ),
"PreviousSales",
CALCULATE (
COUNTROWS ( Orders),
FILTER (
ALL ( 'Calendar' ),
'Calendar'[Date] < MIN ( 'Calendar'[Date] )
)
)
),
ISBLANK ( [PreviousSales] )
)
)

 

 

Or you could try other methods

https://finance-bi.com/power-bi-new-and-repeat-customers/

https://www.sqlbi.com/articles/computing-new-customers-in-dax/

 

Best Regards

Maggie

Anonymous
Not applicable

Thanks Juanli it's seems to work !! thank you !! 

 

 

amitchandak
Super User
Super User

@Anonymous , try like

New Customers =
var _min = MINX (allselected('Calendar'), 'Calendar'[Date] )
return
countx (
FILTER ( summarize (Customers[ID],"PreviousSales",CALCULATE (COUNTROWS ( Orders),FILTER (ALL ( 'Calendar' ),'Calendar'[Date] < _min))
, "_this",COUNTROWS ( Orders)),ISBLANK ( [PreviousSales] ) ) )

 

unless this month data is not in context it will not give customer

Anonymous
Not applicable

@ amitchandak  Thank you for your reply ! 

 

The measure is not working, it doesnt recognize Customer ID in the formulas....

 

Cheers

Ilhame

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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