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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

How to calulate Lost Customers every month

Hello!

 

I'm in stuck with my problem, searched trough the forum posts but did not find suitable solution.

 

I need to calculate how much lost customers do I have every month. Lost customer in my case is customer whose last volumes were 12 months ago.

 

Here is how my data model looks like:

 

YearMonthOrganisationVolumes
2017-10Customer11
2017-11Customer213
2017-12Customer318
2017-12Customer42
2018-02Customer513
2018-03Customer63
2018-04Customer74
2018-05Customer55
2018-06Customer57
2018-07Customer55
2018-08Customer717
2018-09Customer512
2018-10Customer613
2018-11Customer68
2018-12Customer515
2018-13Customer77

 

so, according above data expected result is to have such report:

 

 2018-092018-102018-11
No. of lost Customers112

 

 

and get a list of customers names with period when it was lost and period when last transaction happened, smtg like this:

 

OrganisationLostMonthLastTransaction
Customer12018-092017-10
Customer22018-102017-11
Customer32018-112017-12
Customer42018-112017-12

 

Thanks in advance!

8 REPLIES 8
v-juanli-msft
Community Support
Community Support

Hi @Anonymous

As for the "year-month" table in my last post, you could create it in excel manually, then import to power bi.

Or you could create it in power bu desktop with this formula

Table =
VAR calendartable =
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2017, 1, 1 ), DATE ( 2018, 12, 31 ) ),
        "year", YEAR ( [Date] ),
        "month", MONTH ( [Date] ),
        "year-month", YEAR ( [Date] ) & "-"
            & FORMAT ( MONTH ( [Date] ), "mm" ),
        "year/month/day", MONTH ( [Date] ) & "/"
            & 1
            & "/"
            & YEAR ( [Date] )
    )
RETURN
    SUMMARIZE ( calendartable, [year], [month], [year-month], [year/month/day] )

You could see the result of this formula in my pbix called "Table"

 

Best Regards

Maggie

v-juanli-msft
Community Support
Community Support

Hi @Anonymous  

 

calcuated measures and columns in "Customers"

calculated column :
date/year/month = RELATED('year-month'[date])

measure:
last_date =
CALCULATE (
    MAX ( Sales[date/year/month] ),
    FILTER ( ALL ( Sales ), [Customer ID] = MAX ( [Customer ID] ) )
)


last-month = FORMAT([last_date],"yyyy-mm")

lost = [last_date]+364

calculated column:
lost-month = FORMAT([lost],"yyyy-mm")

measure:
no-lost cus = CALCULATE(DISTINCTCOUNT(Sales[Customer ID]),ALLEXCEPT(Sales,Sales[lost-month]))

revenue = SUM(Sales[Volumes])

lost customer revenue =
CALCULATE (
    SUM ( Sales[Volumes] ),
    FILTER (
        ALL ( Sales ),
        [Customer ID] = MAX ( [Customer ID] )
            && [date/year/month] <= [lost]
            && [date/year/month] >= [last_date]
    )
)

1.png

 

 

 

Please refer to my pbix,

If you have any problem, please let me know.

 

Best Regards

Maggie

Anonymous
Not applicable

Hi @v-juanli-msft, thanks for your input. So I have found LostCustomers by period. Now I need to calculate lost customer revenue (I have a measure TotalRevenue already calculated) last 12 months before they were lost. 

 

For example. Customer lost on 2018-Oct, so I need to know how much total revenue they had in period from 2017-Nov up to 2018-Oct.

 

thanks in advance!

 

Hi @Anonymous

I update my post, please have a looto see if it helps you in this scenario.

 

Best Regards

Maggie

Anonymous
Not applicable

Hello @v-juanli-msft,

 

Here is my data model: https://1drv.ms/f/s!AkvcTGBsDXLLgw9ogz2E0IEA1x_y

 

I tried various ways to find out lost customers and their volumes and revenue 12 months prior lost but did not found proper solution. Kindly please assist.

 

Tomas

 

LivioLanzo
Solution Sage
Solution Sage

Hello @Anonymous

 

 

check out my example here: https://1drv.ms/u/s!AiiWkkwHZChHj1Pow1W04Iiu_L8K

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

AlB
Community Champion
Community Champion

Hi @Anonymous

Have a look at this. It's complex but I think it will be useful for what you are trying to do.

 

Anonymous
Not applicable

thank you @AlB, @LivioLanzo it was useful.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors