Forum Discussion

powerbiexpert22's avatar
powerbiexpert22
Impactful Individual
2 years ago
Solved

lost customers

the lost customers should show 0 it is showing 4 as below highlighted, i have created 3 measures to calculate lost customers.

lost customers are those customers who have not done any purcase last 2 months

 

please see sample pbix file:

https://drive.google.com/file/d/1d0xhBx_VIL-Z9XRR5TaJIKwaGUGK8FqK/view?usp=drive_link

 

 

 

 

Lost Customers Logic:

 

saleslast2months =
CALCULATE(Sales[salesamount],
DATESINPERIOD('Date'[Date],LASTDATE('Date'[Date]),-2,MONTH))
 
lostcustomer_flag =
IF(ISBLANK(Sales[saleslast2months]),"Lost",Sales[salesamount])
 
LostCustomers =
CALCULATE(
    DISTINCTCOUNT(Customers[customer_id]),
    FILTER(Customers,[lostcustomer_flag]="Lost"))
 
 
  • Hi powerbiexpert22 

    The output seems to be working as per the logic[No purchase in last 2 month], as of 12-01-2024 c1 has made a purchase while other 4 has not. 

    Can you explain the requirement a bit more elaborate?

    If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

    Follow me on LinkedIn!!!


    LinkedIn

6 Replies

  • NaveenGandhi's avatar
    NaveenGandhi
    Memorable Member

    Hi powerbiexpert22 

    The output seems to be working as per the logic[No purchase in last 2 month], as of 12-01-2024 c1 has made a purchase while other 4 has not. 

    Can you explain the requirement a bit more elaborate?

    If this post helps, then please consider Accept it as the solution to help the others find it more quickly. Appreciate you kudos!!

    Follow me on LinkedIn!!!


    LinkedIn

  • powerbiexpert22's avatar
    powerbiexpert22
    Impactful Individual

    Hi AnkitaaMishra , NaveenGandhi 

     

    Lost customers are those customers who placed orders before last 2 months from the specified date however they did not place any order within last two months from the specified date , below is the explanation based on the data 

    DateLost Customer CountReason
    12-01-20240There are no customers who placed any order before 12-Nov-2023
    14-02-20240There are no customers who placed any order before 14-Dec-2023
    15-02-20240There are no customers who placed any order before 15-Dec -2023
    16-03-20240There is 1 customer who placed orders before 16-Jan-2024 i.e C1 on 12th Jan 2024 but he placed another order on 14th Feb 2024 so he is not the lost customer
    26-04-20242There are 2 customers who placed orders before 26-Feb-2024 i.e. C1,C2 and they have not placed any order between 26-Feb-2024 and 26-Apr-2024 so these two are lost customers
    28-04-20242There are 2 customers who placed orders before 28-Feb-2024 i.e. C1,C2 and they have not placed any order between 28-Feb-2024 and 28-Apr-2024 so these two are lost customers
    31-05-20243There are 3 customers who placed orders before 31-Mar-2024 i.e. C1,C2,C3 and they have not placed any order between 31-Mar-2024 and 31-May-2024 so these three are lost customers