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
cnpdx
Helper II
Helper II

How do I calculate Lost Customer Sales?

 

I am trying to calcluate;

"what were sales last month of customers who didn't purchase this month?"

 

This article was amazing, and a real game changer to help calculate returning, new and lost customer counts. As well as sales of new and returning customers: 

 

New and Returning Customers

 

 

 

Can anyone modify or add to the above article to cacluate sales of customers last month who didn't purchase this month? using same syntax and variables as in the article. thank you so much for your help!!

 

 

3 ACCEPTED SOLUTIONS
Vvelarde
Community Champion
Community Champion

@cnpdx

 

Lookvalue have a result which is not a boolean expression.

 

In your case, you have to add IF(lookvalue........) <> Blank() 

 

When the result is blank the formula give you a value and when is not another value ("Y" or "")

 

 




Lima - Peru

View solution in original post

Vvelarde
Community Champion
Community Champion

@cnpdx

 

Try with this:

 

IF

(

   IF(SalesDetails<>12,

            IsBlank(LookupValue(....)),

            IsBlank(LookupValue(....))

),

"Y",""

)

 




Lima - Peru

View solution in original post

cnpdx
Helper II
Helper II

This is all you need:

 

Lost customer sales = CALCULATE ( [SALES],PREVIOUSMONTH('DATE[DATE]),FILTER(CUSTOMER,[SALES]=0)  

 

 

View solution in original post

8 REPLIES 8
cnpdx
Helper II
Helper II

This is all you need:

 

Lost customer sales = CALCULATE ( [SALES],PREVIOUSMONTH('DATE[DATE]),FILTER(CUSTOMER,[SALES]=0)  

 

 

v-qiuyu-msft
Community Support
Community Support

Hi @cnpdx,

 

In your scenario, you can create a calculated column like below:

 

PurchaseLastmonthNotthis month =
VAR CKey = Sales[CutomerKey]
return
IF(IF('Sales'[Month]<>12,
LOOKUPVALUE( Sales[CutomerKey], Sales[CutomerKey], CKey, Sales[Month], Sales[Month] + 1),LOOKUPVALUE( Sales[CutomerKey], Sales[CutomerKey], CKey, Sales[Month], 1,Sales[Year],Sales[Year]+1))=BLANK(),"Y","")

 

q4.PNG

 

Best Regards,
Qiuyun Yu

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

Hi @v-qiuyu-msft,

Thanks for responding!

 

I totally get your logic and I think it will work for my problem, I'm just having a syntax issue. Can you take a look:

 

Thanks for your help!

pbi 12.19.PNG

 

 

Vvelarde
Community Champion
Community Champion

@cnpdx

 

After Blank add a )




Lima - Peru

Hi @Vvelarde

 

Thanks, adding the ) worked, but now I get this new error. does anyone have a solution for that (pic)? The error says it doesn't like the customer key field (text)...

 

 

 

pbi error.PNG

Vvelarde
Community Champion
Community Champion

@cnpdx

 

Lookvalue have a result which is not a boolean expression.

 

In your case, you have to add IF(lookvalue........) <> Blank() 

 

When the result is blank the formula give you a value and when is not another value ("Y" or "")

 

 




Lima - Peru

i'm just not clear where that IF(lookvalue........) <> Blank() fits in to the whole formula. can you elaborate?

Vvelarde
Community Champion
Community Champion

@cnpdx

 

Try with this:

 

IF

(

   IF(SalesDetails<>12,

            IsBlank(LookupValue(....)),

            IsBlank(LookupValue(....))

),

"Y",""

)

 




Lima - Peru

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.

Top Solution Authors