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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Eszti
Frequent Visitor

Cohort analysis - customer churn matrix

Hi everyone,
I am working on a project that I am not qualified for and despite doing a lot of research and trying to follow tutorials I am still stuck with my cohort analysis.

I am trying to create a matrix showing the development in the number of active customers in each cohort over time, as it is shown in the article below.

Eszti_0-1706110163476.pnghttps://medium.com/@ramzaftab/learn-how-to-build-cohort-analysis-using-power-bi-b13a38e80e9d

 

For rows, I have Calendar_table[Month & Year]. The calendar table has a one-to-many relationship to the subscription table.

 

For columns, I am trying to use
Months After = GENERATESERIES(0,11,1)

Attempt1 =
VAR CohortStartMonth =

    SELECTEDVALUE ( Subscriptions_export[Join Month] )

VAR CurrentMonth =

    EOMONTH ( CohortStartMonth, SELECTEDVALUE ('Months After'[Value]))

RETURN

    CALCULATE (

        COUNTROWS ( VALUES(Subscriptions_export[Customer email])),

        Subscriptions_export[CreatedatAtDate EOM] = CurrentMonth)

 

Attempt2=

CALCULATE(

    VAR minDate = MIN(Subscriptions_export[Join Month])

    VAR maxDate = CALCULATE(MAX(Subscriptions_export[Exit Month]), NOT(ISBLANK(Subscriptions_export[Exit Month])))

    RETURN

    COUNTROWS(

        FILTER(

            Subscriptions_export,

            Subscriptions_export[Join Month] >= minDate

            && Subscriptions_export[Exit Month] <= maxDate

        )

    )

)

 

When I try to use the measures to create the matrix attempt 1 only shows one column for time 0 and attempt2  displays the same number (the value for time 0) for all ‘months after’ in every row.

Could anyone help me, please?

2 REPLIES 2
Eszti
Frequent Visitor

Sorry for the very late reply. Here is a stripped version (due to data privacy) of the pbix file. The only change I made relative to the original post is that I am using 'Customer ID' as the primary key instead of 'Customer email'.

https://drive.google.com/file/d/1sB9Btvl2Fx1P26cfyROtZAilkzln_Q6i/view?usp=sharing 

Anonymous
Not applicable

Hi @Eszti ,

Can you provide the pbix file, please?

Best Regards,

Xianda Tang

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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