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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
SammyNed
Helper I
Helper I

Customers without purchases in >6 months

Hi Team,

 

Can someone please assist? So i have simplified data as below, a sales table showing the customer_id's and dates when they have ordered from us. I would like to output a table (table 2 below) showing the customers who haven't bought in the preceding 6 months, accumulative tho. So Customer C only purchased in Jan, so in Aug he hasn't purchased in the last 6 months and gets added to the "lost" customer count in Aug, Sep, Oct & Nov. but he orders again in Dec so he is no longer a "lost" customer.  

 

SammyNed_2-1636440973152.png

SammyNed_3-1636441098386.png

 

Thanking you in advance for your assistance

 

 

 

 

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @SammyNed 

Here's a measure to count the lost customers.

It gets a list of customers in the last 6 months, a list of customers before the last 6 months, then sees who is in the 2nd list and not the 1st.

Lost Customers = 
VAR _CurrentDate = MAX('Date'[Date])
VAR _6MonthsAgo = EOMONTH(_CurrentDate, -6)
VAR _Last6MonthCustomers =
CALCULATETABLE(
    VALUES(Sales[Customer_ID]),
    DATESINPERIOD('Date'[Date], _CurrentDate, -6, MONTH)
)
VAR _BeforeLast6MonthCustomers = 
CALCULATETABLE(
    VALUES(Sales[Customer_ID]),
    REMOVEFILTERS('Date'[Date]),
    'Date'[Date] <= _6MonthsAgo
)
VAR _LostCustomers = EXCEPT(_BeforeLast6MonthCustomers, _Last6MonthCustomers)
RETURN
    COUNTROWS(_LostCustomers)

View solution in original post

5 REPLIES 5
PaulOlding
Solution Sage
Solution Sage

Hi @SammyNed 

Here's a measure to count the lost customers.

It gets a list of customers in the last 6 months, a list of customers before the last 6 months, then sees who is in the 2nd list and not the 1st.

Lost Customers = 
VAR _CurrentDate = MAX('Date'[Date])
VAR _6MonthsAgo = EOMONTH(_CurrentDate, -6)
VAR _Last6MonthCustomers =
CALCULATETABLE(
    VALUES(Sales[Customer_ID]),
    DATESINPERIOD('Date'[Date], _CurrentDate, -6, MONTH)
)
VAR _BeforeLast6MonthCustomers = 
CALCULATETABLE(
    VALUES(Sales[Customer_ID]),
    REMOVEFILTERS('Date'[Date]),
    'Date'[Date] <= _6MonthsAgo
)
VAR _LostCustomers = EXCEPT(_BeforeLast6MonthCustomers, _Last6MonthCustomers)
RETURN
    COUNTROWS(_LostCustomers)

Thanks Team. It's what i'm looking for. Thanks very much

@PaulOlding 

thank for the nice Solution. It's working really fine.

Now i'working with the measure and if i dont put it into the context of a customer, for example i put the Lost Customer in a card visual, i'll get i other number like in a Table in Context with the Customer Number.

You have an idea, why?

Thanks @PaulOlding 

This solution works for what i need. 

amitchandak
Super User
Super User

@SammyNed , with help of the date table, find rolling 6-month sales or the count

 

example

Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-6,MONTH))

 

Lost customer =

Countx(Values(Customer[Customer]), if(isblank([Rolling 6 ]), [Customer], blank()) )

 

 

refer

Customer Retention Part 5: LTD Vs Period Retention
https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-5-LTD-and-PeriodYoY-Retentio...

Customer Retention Part 2: Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retenti...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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