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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Habreu
New Member

Cohort retantion by churn

Hey there! 
So, my table has 3 date columns; Register date and Churn date.

I want to calculate the retention of each month, using the register date as cohort criterea, and, measure the number of clients that still using my app  by month using churn date as the date we lost the client. 

I dont know how to write this formula on DAX. 

This is an example of what i want:
In Jan, whe have 17 new clients. In may we lost 5 of our jan clients:

Habreu_0-1640130835059.png
tx

 

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Habreu ,

 

I create two calendar tables which have no relationship between them. X and Y .

Create table code:

X =
VAR _c =
    CALENDAR( DATE( 2021, 1, 1 ), DATE( 2021, 12, 31 ) )
RETURN
    ADDCOLUMNS( _c, "Xmonth", FORMAT( [Date], "mm/mmm/yy" ) )

Y the same as X.

And the matrix values use the following measure:

retention of each month =
VAR _S =
    FILTER(
        'Table',
        [RegisterDate] <= MAX( 'y'[Date] )
            && [RegisterDate] >= MIN( 'y'[Date] )
            && [ChurnDate] >= MIN( X[Date] )
    )
RETURN
    IF( MIN( X[Date] ) >= MIN( Y[Date] ), COUNTROWS( _S ), BLANK() )

Result:

vchenwuzmsft_0-1640334020848.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
mahoneypat
Microsoft Employee
Microsoft Employee

On the Modeling tab, click on New Table and enter this expression (adapt to match your current table and column name). There should be no relationship between the two tables.

 

ChurnDates = DISTINCT(Churn[ChurnDate])
 
Pat
 




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


v-chenwuz-msft
Community Support
Community Support

Hi @Habreu ,

 

I create two calendar tables which have no relationship between them. X and Y .

Create table code:

X =
VAR _c =
    CALENDAR( DATE( 2021, 1, 1 ), DATE( 2021, 12, 31 ) )
RETURN
    ADDCOLUMNS( _c, "Xmonth", FORMAT( [Date], "mm/mmm/yy" ) )

Y the same as X.

And the matrix values use the following measure:

retention of each month =
VAR _S =
    FILTER(
        'Table',
        [RegisterDate] <= MAX( 'y'[Date] )
            && [RegisterDate] >= MIN( 'y'[Date] )
            && [ChurnDate] >= MIN( X[Date] )
    )
RETURN
    IF( MIN( X[Date] ) >= MIN( Y[Date] ), COUNTROWS( _S ), BLANK() )

Result:

vchenwuzmsft_0-1640334020848.png

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 
mahoneypat
Microsoft Employee
Microsoft Employee

To do that, you'll need to make a disconnected table with your Churn dates or months, using DISTINCT or VALUES, and then use that for the columns in your matrix (the ChurnDates[ChurnDate] in the measure). Then use a measure like this one.

 

mahoneypat_0-1640133033813.png

Remaining =
VAR thischurndate =
    MIN ( ChurnDates[ChurnDate] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( Churn[Customer] ),
        FILTER ( ALL ( Churn[ChurnDate] ), Churn[ChurnDate] >= thischurndate )
    )

 

Pat

 

 

 

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Hey Pat, fisrt, thanks for helping me. 

I am trying your solution, but i guess i am missing the step " make a disconnected table with your Churn dates or months, using DISTINCT or VALUES"  (because i dont know how).

And this is re result i am getting: 

Habreu_0-1640190654578.png

Here is how i build the matrix :
linhas (rows) : register date 

colunas(columns) : churn date
valores(values) remaining
I am using the same measure that you show to calculate remaings 

 

Habreu_1-1640190697773.png

 

tx matte

 

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.