Forum Discussion

mazwro's avatar
mazwro
Helper II
2 years ago
Solved

calculating churn

Hi, I have a simple table as follows in screenshot: I want to be able to create a flag to tell if a client is churned - e.g. have seen them purchased in the last 12 months, and I have not idea how t...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi mazwro ,

     

    Thanks for the reply from MattAllington .

     

    Please try:

     

    Create a calculated column that considers a customer churned if they have not made a purchase within the past 12 months of the maximum date in the data set.

    IsChurned =
    var PY = CALCULATE(
    MAX('Table'[order_YM]),
    DATESINPERIOD(
    'Table'[OrderDate],
    MAX('Table'[OrderDate]),
    -12,MONTH)
    )
    RETURN
    IF(PY = BLANK(),"Churned", "Active")

     

    Create a measure to calculate the number of churned customers:

    Count =
    CALCULATE(
    COUNTROWS('Table'),
    'Table'[IsChurned] = "Churned",
    ALLEXCEPT('Table', 'Table'[order_YM])
    )

     

    If the problem is not solved successfully, I would be grateful if you could provide me with the pbix file or sample data.

     

    Remember to remove sensitive data and do not log in to your account in Power BI Desktop when uploading the pbix file.

     

    If you have any other questions please feel free to contact me.

     

    The pbix file is attached.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi mazwro ,

     

    Thanks for the reply from MattAllington .

     

    This formula returns the churn rate for the last 12 months for the maximum date in your table.

     

    If you have any other questions please feel free to contact me.

     

    Best Regards,
    Yang
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!