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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
sudheerbolla
Helper II
Helper II

NEED HELP IN GETTTING RUNNING TOTAL IN COHORT ANALYSIS

Hi every one, @Ashish_Mathur
 
Need running total in Cohort Analysis
an hour ago

 

Policy Attrition Count:

The following table obtained:

POLICY ATTRITION MATRIX (COHORT ANALYSIS)

sudheerbolla_0-1688428818929.png

 

 

Description of output: In Apr-2023, 1456 no of new policies were taken, out of 1456 new policies, 20 no of policies were cancelled in Apr-2023, and 63 no of policies were cancelled in May-2023 excluding the 20 no of policies cancelled in Apr-2023.

The above output obtained by using the following DAX function

Policy Attrition =

VAR vCurrentMonthAfter = SELECTEDVALUE(Tenure_Table[Value])

VAR vCurrentCohort = SELECTEDVALUE(Consolidated[Cohort])

VAR vleft =

CALCULATE(

    [NewPolicies],

    FILTER(

        Consolidated,

        EOMONTH(Consolidated[PolicyCancelDateColumn],0)=EOMONTH(vCurrentCohort,vCurrentMonthAfter)

    )

)

RETURN

vleft

 

 

Tenure_Table = GENERATESERIES(0,24,1)

 

 

Cohort =

VAR vPolicyNo = Consolidated[POLICY_NUMBER (Imported)]

VAR vResult = CALCULATE(

    EOMONTH(MIN([PolicyPurcDateColumn]),0),

    FILTER(Consolidated,Consolidated[POLICY_NUMBER (Imported)]=vPolicyNo)

)

RETURN

vResult

 

NewPolicies = DISTINCTCOUNT(Consolidated[POLICY_NUMBER (Imported)])

 

 

 

How to get the cumulative policies cancelled output as below. How to write the dax function to get the following output

 

POLICY ATTRITION MATRIX (RUNNING TOTAL ) (COHORT ANALYSIS)

 

sudheerbolla_1-1688428818917.png

 

The above out put will help  me in creating the retention matrix, by substracting the retention matrix values from the new policies count.

 

 
 

https://www.dropbox.com/scl/fi/3qmevl7qq5h6671i050dr/OUTCOME-1.xlsx?rlkey=iywhx8nwsk8cg6r24sgvuetap&...

https://www.dropbox.com/scl/fi/l6chb5124ryh5ezcfw2ip/Sample-Data.xlsx?rlkey=mnv7cmihut6atk48lsm2nx8d...

 

 

 

 

2 ACCEPTED SOLUTIONS

Hi,

Since you want the answer for April 2023 to be 1,456 and not 1,436, it is implied that you want to compute the number of active policies as on the first of the month.  If my assumption is correct, then please download my solution file.

Hope this helps.

Untitled.png


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

View solution in original post

Hi,

Please find attached my solution file.

Hope this helps.

Untitled.png


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

View solution in original post

17 REPLIES 17
Ashish_Mathur
Super User
Super User

How did you derive the answer of 1456 for April 2023?  What filters should i apply on the Excel file to get that number?


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

1456 is the no of new policies taken in APR-2023.

sudheerbolla_0-1688467611699.png

I USED CONDITIONAL COLUMN 

sudheerbolla_2-1688467811983.png

sudheerbolla_3-1688467892229.png

 

 

THIS IS THE OUTCOME I GOT BY ABOVE, 

sudheerbolla_1-1688467703608.png

I AM UNABLE TO GET 83 (20+63) INSTEAD OF 63 IN COLUMN 1 AGAINST THE ROW APR-2023 LIKE WISE FOR ALL THE ROWS OF MONTH-YEAR.

COULD YOU DO IT IN POWER BI. IF YOU ARE DOING IN EXCEL, CAN IT BE APPLIED SAME IN POWER BI

 

 

How did you arrive at 20 under the 0 column for April 2023?  I am assuming that means the policies that were bought and terminated in April 2023.  If my understanding is correct, then the number under that column should be 5.  How are you getting 20 there?

Untitled.png 


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

I USED THE FOLLOWING DAX FUNCTION TO GET THE POLICY CANCELATION DATE.

A POLICY NO (LETS SAY "X") CAN HAVE MULTIPLE RECORDS BASED ON THE TRASACTIONS HAPPENED TO THAT POLICY.

If the event is create_policy, record 1 is generated for policy no X

if the event is policy_renewal (after the policy term 6 months) 2nd record is generated for policy no X

if the event is update_policy (adding extra person to policy) 3rd record is generated for plicy no X

if the event is cancel_policy, 4th record is generated for policy no X.

 

 

PolicyCancelDateColumn = Var _PolicyNo = (Consolidated[POLICY_NUMBER (Imported)])
Return
IF(
    OR(
        (Consolidated[EVENT_CODE (Imported)])="cancel_policy",
        (Consolidated[EVENT_CODE (Imported)])="cancel_policy_non_payment"
    ),
MAXX(FILTER(ALL(Consolidated),Consolidated[POLICY_NUMBER (Imported)]=_PolicyNo),Consolidated[Crediting Date]),
BLANK()
)

Also, of all the different date columns available, just tell me which is the policy start date column and which is the end date column


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

Policy start date is the minimum date in crediting date for a policy no because policy no can have mulitple records when a policy under go renewal or cancellation or update.

 

policy end date is the maximum date in crediting date of the policy number for an event code "policy_cancel" or "policy_cancel_non_payment"

Hi,

Since you want the answer for April 2023 to be 1,456 and not 1,436, it is implied that you want to compute the number of active policies as on the first of the month.  If my assumption is correct, then please download my solution file.

Hope this helps.

Untitled.png


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

Thank you so much for your hard work, you are very near to the solution.

It should have the values as below

 

 total policiesjanuaryfebruarymarchaprilmay
Jan-23410399389370358349
Feb-23544527509492473 
Mar-231279124311821117  
Apr-23145614361373   
May-2315811553    

 

if total policies column is not possible, it is fine. Could you please try to get as above.
Thank you in advance

Can it be arranged in this way as shown below, the count of policies retained at end of the month.

 

  januaryfebruarymarchaprilmay
Jan-23 399389370358349
Feb-23 527509492473 
Mar-23 124311821117  
Apr-23 14361373   
May-23 1553    

 

if total policies column is not possible, it is fine. Could you please try to get as above.
Thank you in advance

Hi,

Please find attached my solution file.

Hope this helps.

Untitled.png


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

I have gone through your previous solution and it helped me understanding the approach to the solution. You have a vast knowledge in power bi. Thank you so much for your guidence.

sudheerbolla_0-1688833179154.png

I appreciate you. I am new to the Power BI.

Thank you

 

You are welcome.  How did you get the column headers as numbers i.e. 1,2,3?  Please share your PBI file.


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

Policy start date is the minimum date in crediting date for a policy no because policy no can have mulitple records when a policy under go renewal or cancellation or update.

 

policy end date is the maximum date of the policy number for an event code "policy_cancel" or "policy_cancel_non_payment"

 

Let's not focus on the DAX formulas for now.  What would you treat as the cancellation date of policy number TANDBZLV9C?  Will it be October 27, 2023?  Please also show in the Excel file (no DAX formulas) as to how you arrived at 20 under column 0 for April 2023?


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

yes the cancellation date is October 27, 2023 (to be taken from the crediting date column against the policy no TANDBZLV9C

Ashish_Mathur
Super User
Super User

Hi,

As per my approach of solving this question, there should exist one row for each month of every policy from the beg to the end date.  So for example, policy TA2M2RFQL8 has only one row and this policy is effective from May 2023 to Nov 2023.  My approach would be to split this into 7 rows - one for each month.  This will lead to an increase in th size of the table.  If you are OK with this approach, then i can try out my solution.


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

No problem, you can split it. Thank you very much

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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