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
dhooger
Helper I
Helper I

Count customers returning after three months of inactivity

I'm looking to write DAX to calculate a count of customers buying at least 3 units this month that have not purchased in the three previous months. The count should work at the month level and should sum at the year level.

 

Examples:

Customer A has never purchased and in Jan 2018, they buy 3 units. Thus they would be a new customer in Jan 2018. They then buy 3 additional units again in May 2018. This is a new customer in May 2018. If you summed the new customers in 2018, it would still only be one new account because there is only one store.

 

Customer B has never purchased and in Jan 2018, they buy 1 unit. Thus they would NOT be a new customer in Jan 2018. They then buy 2 additional units again in May 2018. This is NOT a new customer in May 2018. AND, even though they have now bought a total of 3 units in 2018, we do not consider them a new account for the year because there was not a purchase of 3 units in a given month.

1 ACCEPTED SOLUTION

Hi @dhooger ,

 

Let me know if you'd like to get below results:

1.PNG

pbix attached: https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EdISJcm05M9PqOiPPeeHej...

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

6 REPLIES 6
dhooger
Helper I
Helper I

Sample data:

 

DateAccountIDProductIDQty
1/1/19A10013
5/1/19A10033
7/1/19A10013
1/1/19B10011
1/1/19B10021
1/1/19B10031
5/1/19B10011
6/1/19B10022
7/1/19B10033

 

Result expected by month:

Month LevelJan-19Feb-19Mar-19Apr-19May-19Jun-19Jul-19
New and/or returning customers2   1 1

Both A and B bought 3 units in Jan and had never bought before.

A bought 3 units in May, which is more than 3 months from Jan so they get a 1 in the May column

A bought 3 units in July, but that is not 3 months from May so they do NOT get a 1 in July.

B bought some units in May and June but not 3 at one time so they do not count in either month.

B did buy 3 units in July and that is more than 3 months from Jan so they get a 1 in the July column.

 

Expected result when looking at year level:

Year Level2019
New and/or returning customers2

 

Even though both A and B qualified in individual months more than one time, they are only shown here once each per year.

Hi @dhooger ,

 

Let me know if you'd like to get below results:

1.PNG

pbix attached: https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EdISJcm05M9PqOiPPeeHej...

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Hi @v-diye-msft ,

 

Would you mind posting the URL again?  I got error message when clicking on https://wicren-my.sharepoint.com/:u:/g/personal/dinaye_wicren_onmicrosoft_com/EdISJcm05M9PqOiPPeeHej...

 

Many Thanks!

This is great and I've added to it by replacing Measure 3 with:
COUNTROWS (
FILTER (
SUMMARIZE (
'SRS Sales',
'SRS Sales'[dim_srs_outlet_key],
'SRS Sales'[Date],
"SumM2", [Measure 2]
),
[SumM2] >= 1
)
)

 

But, now I have a different problem. In the sample data, I assigned things to the same date in a month to represent the month. We have sales throughout the month that we have to summarize for the month. I've used STARTOFMONTH as a calculated column but still not quite getting there. Getting failure on what you had as Measure to work.

Hi @dhooger ,

 

Please kindly mark the helpful answer as solution regarding to your previous question, for the new question, could you please create a new thread?

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Greg_Deckler
Super User
Super User

@marcorusso wrote a quick measure for this: https://community.powerbi.com/t5/Quick-Measures-Gallery/New-and-Returning-Customers/m-p/168297?searc...

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.