Forum Discussion

GekkeHellie's avatar
GekkeHellie
Regular Visitor
3 years ago

Churn Rate Contracts

Hi all,

 

I want to calculate a churn rate (not sure if I'm using the correct term), but I need the a matrix like the one below.

I think the first challenge would be to have the year as a column and row aswell. 

Besides that, I've highlighted some cells yellow.

The yellow cells should show the total contracts at the 1st of January for that specific year.

Let's take the 2020 row as a example, where it would tell that on the 01/01/2020 there were 441 active contracts in total.

Then one year later on 01/01/2021 it would show that of the 441 initial contracts, of 01/01/2020, there are still 412 contracts active and on 01/01/2022 there are 385 contracts active of the 441 initial contracts etc.

The same applies if we look at the 2021 row which starts with 430 active contracts in total on 01/01/2021 and on 01/01/2022 there are still 417 active contracts of the initial 430 active contract of 01/01/2021.

 

If a contract starts on 01/01/2020 and ends on 01/06/2021 it means that it will be included in the 441 (yellow highlighted) on the  2020 row and 430 (yellow highlighted) on the 2021 row. 

But since the contract will be ended during 2021, I would like to see that this contract wil be deducted from the initial active contracts (441 and 430) in 2022 (orange highlighted).

 

At some point in the future it could be that the initial 441 active contracts of 2021 will be 0.

Here are the relationships, that I consider should be should/have impact on the calculation to be made, that are in the model.

 

 

And also a example of how I'm calculating the total active contracts at this moment.

 

# Active Contracts = 

VAR _StartDate =
    MIN('Date'[Date])

VAR _EndDate = 
    MAX('Date'[Date])

VAR _Result =
    CALCULATE(
        COUNTROWS(
            FILTER(
                SUMMARIZE(
                    Contracts,
                    Contracts[HID],
                    Contracts[Status Fixed],
                    Contracts[Main Contract],
                    Contracts[Start Date],
                    Contracts[End Date]
                ),
                Contracts[Status Fixed] = "Processed"
                && Contracts[Main Contract] = "Yes"
                && Contracts[Start Date] <= _EndDate
                &&(
                    Contracts[End Date] >= _StartDate
                    || Contracts[End Date] = BLANK()
                )
            )
        ),
        CROSSFILTER('Date'[Date], Contracts[Start Date], None)
    )

RETURN
    _Result

 

Hopefully I've provided enough information and explained the requirements cleary.

I'm looking forward to your ideas about this issue!

 

 

 

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI GekkeHellie,

    I'd like to suggest you do unpivot columns on these date fields to convert them to attribute and value. Then you can directly use calendar table to link converted fields and use attribute fields group and simply write formula to calculate across different date fields.

    Unpivot columns - Power Query | Microsoft Learn

    Regards,

    Xiaoxin Sheng