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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
powerbiexpert22
Impactful Individual
Impactful Individual

lost customers

how to identify lost customer?

lost customers on given date are those customers who never placed order between past 90 days and future 90 days on given date

 

example lost customers on 01-June-2001 should be those customers who never placed orders between 01st march 2001 and 30-sept-2001

 

below is the sample data

 

powerbiexpert22_0-1710636929762.png

 

 

 

 

powerbiexpert22_2-1710636973693.png

powerbiexpert22_3-1710637009034.png

 

 

 

 

 

 

 

 

 

 

 

 

2 ACCEPTED SOLUTIONS
talespin
Solution Sage
Solution Sage

hi @powerbiexpert22 

 

I used Contoso Sales

 

This measure checks for Sales +/- 90 days from 2012-06-01, since I did not have recent data. Please change it to Today() or as per your need.

 

Sales Plus Minus 90 Days =
VAR _StartDate = DATE(2012,6,1) - 90
VAR _EndDate = DATE(2012,6,1) + 90
VAR _SalesCount = CALCULATE( COUNTROWS(Orders), 'Date'[Date] >= _StartDate && 'Date'[Date] <= _EndDate)

RETURN IF(_SalesCount = 0, "Lost Customer", BLANK())

View solution in original post

Anonymous
Not applicable

Hi @powerbiexpert22 

 

First of all, thanks to @talespin for your timely and effective response.

 

Here are my additions.

 

My slicer table:

vxuxinyimsft_1-1710750114205.png

 

You can create a measure as follows.

Measure = 
VAR _selectedvalue = SELECTEDVALUE('Date'[Date])
VAR _l90 = EOMONTH(_selectedvalue, -4) + 1
VAR _f90 = EOMONTH(_selectedvalue, +3)
VAR _cid = CALCULATE(MAX('order'[customerid]), FILTER('order', [orderdate] >= _l90 && [orderdate] <= _f90))
VAR _cname = CALCULATE(MAX(customer[name]), FILTER('customer', [customerid] = _cid))
RETURN
IF(MAX(customer[name]) = _cname, BLANK(), "lost customer")

 

Result:

vxuxinyimsft_0-1710750082896.png

 

If this is not the result you want, please show the result you want in excel format so we can help you better.

 

Best Regards,
Yulia Xu

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @powerbiexpert22 

 

First of all, thanks to @talespin for your timely and effective response.

 

Here are my additions.

 

My slicer table:

vxuxinyimsft_1-1710750114205.png

 

You can create a measure as follows.

Measure = 
VAR _selectedvalue = SELECTEDVALUE('Date'[Date])
VAR _l90 = EOMONTH(_selectedvalue, -4) + 1
VAR _f90 = EOMONTH(_selectedvalue, +3)
VAR _cid = CALCULATE(MAX('order'[customerid]), FILTER('order', [orderdate] >= _l90 && [orderdate] <= _f90))
VAR _cname = CALCULATE(MAX(customer[name]), FILTER('customer', [customerid] = _cid))
RETURN
IF(MAX(customer[name]) = _cname, BLANK(), "lost customer")

 

Result:

vxuxinyimsft_0-1710750082896.png

 

If this is not the result you want, please show the result you want in excel format so we can help you better.

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

talespin
Solution Sage
Solution Sage

hi @powerbiexpert22 

 

I used Contoso Sales

 

This measure checks for Sales +/- 90 days from 2012-06-01, since I did not have recent data. Please change it to Today() or as per your need.

 

Sales Plus Minus 90 Days =
VAR _StartDate = DATE(2012,6,1) - 90
VAR _EndDate = DATE(2012,6,1) + 90
VAR _SalesCount = CALCULATE( COUNTROWS(Orders), 'Date'[Date] >= _StartDate && 'Date'[Date] <= _EndDate)

RETURN IF(_SalesCount = 0, "Lost Customer", BLANK())

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.