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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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.


Follow on LinkedIn
@ 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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