cancel
Showing results 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

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:

tx

1 ACCEPTED SOLUTION
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:

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.

5 REPLIES 5
Super User

Hi,

Regards,
Ashish Mathur
http://www.ashishmathur.com
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!

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:

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.

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.

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!

New Member

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:

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

tx matte

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors