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
wesfletcher
Frequent Visitor

Lost Customers - Also counting recovered customers

Hi, I'm new to power bi and dax calculations. I've spent the last few hours trying to solve an issue I'm having with a lost customers formula. The issue is the formula includes some recovered customers in the lost customers list. While the customers were technically lost and recovered in the same year (i.e. one customer went from Q1 2016 until Q2 2017 without a sale, so greater than 365 days), I'm confusing my sales team by including customers in both lists. I've pasted the lost customers formula below. Any and all help would be greatly appreciated!

 

2 Lost Customers =
COUNTROWS (
FILTER (
ADDCOLUMNS (
FILTER (
CALCULATETABLE (
ADDCOLUMNS (
VALUES (SalesInvoice[Customer Group]),
"CustomerLostDate",
CALCULATE (MAX( SalesInvoice[Date])) + 365),
FILTER (
ALL ( DimDate ),
AND (
DimDate[Date] < MIN (DimDate[Date]),
DimDate[Date] >= MIN (DimDate[Date]) - 365))),
AND (
AND (
[CustomerLostDate] >= MIN ( DimDate[Date]),
[CustomerLostDate] <= MAX ( DimDate[Date])),
[CustomerLostDate] <= CALCULATE ( MAX ( SalesInvoice[Date]), ALL ( SalesInvoice)))),
"FirstBuyInPeriod", CALCULATE (MIN(SalesInvoice[Date]))),
OR (
ISBLANK ([FirstBuyInPeriod]),
[FirstBuyInPeriod] > [CustomerLostDate])))

 

 

Capture.JPG

4 REPLIES 4
wesfletcher
Frequent Visitor

Bump.

wesfletcher
Frequent Visitor

bump.

Greg_Deckler
Super User
Super User

Can you post some sample/example data? It is very difficult to just look at complex DAX code and see what the issue is, you generally have to mess around with it a bit and for that you need the data.


@ 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...

I added data to the original post.

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.