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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
orlandopowerbi
Frequent Visitor

Policy Retention

Hello Everyone,

 

I've been stuck quit a while with this and I'm pretty sure there is a simple way to do these but I've always struggle with filters.

 

Data sample pbix:

https://1drv.ms/u/s!AqZ-UB8XHC8si3JwwFVo_kInMdD4?e=riqnGQ

 

Context: Data that contains information about policies from January to August 2021 and for how long they have been in force.

Important fields:

  • Tenurefirstmonth: Inception date of the policy.
  • TotalMonthDurationDR : Number of complete months that the policy has been in force.
  • TenureStartYearMonth : Inception month of the policy.

I am trying to create a Retention visual. First I created the following measure (reverse cumulative) :

 

Retention = 
var retention = CALCULATE([Policy Count],FILTER(ALL(Sheet4[TotalnMonthDurationDR]),Sheet4[TotalnMonthDurationDR]>=min(Sheet4[TotalnMonthDurationDR])))
return
if(ISBLANK([Policy Count]),blank(),retention)

 

So that when placed in a line graph with the TotalMonthDurationDR as x-axis basically shows how many policies have completed 0,1,2,3... months:

orlandopowerbi_1-1632091557743.png

Good, now, the final part that I cant seem to achieve is to divide this measure by the number of policies that have been issued, to show the Retention %. Here is the tricky part, I only want to divide by the total count of issued policies that already could have make it to the 5th,6th,7th.. month. So for example, the 120 policies that already have 7 months of being active, will be divided by the policies issued in January 2021 (because only those policies could have reached the 7th month). The 256 policies that have 6 months of active will be divided by the policies issued in January or Februrary 2021, and so on.

 

The desired output of the measure of this specific example would be the division of Retention column and Total Column:

orlandopowerbi_3-1632092820647.png

 

So the solution measure would have to compare the TotalMonthDuration with the with the diferences between the months and August2021 (since is the last analyzed month). A measure thay I tested with no success to calculate this issued policies is :

 

Test = 
var maxdate = CALCULATE(MAX(Sheet4[TenureStartyearmonth]),ALL(Sheet4[TenureStartyearmonth])) // August 2021
var issued = CALCULATE(COUNT(Sheet4[TotalnMonthDurationDR]),ALL(Sheet4[TotalnMonthDurationDR]),FILTER(Sheet4,Sheet4[TenureStartyearmonth]<=EDATE(maxdate,-Sheet4[TotalnMonthDurationDR])))
return
issued

 

 

 

Considerations:

  • I would like to keep slicing capability of the TenureStartYearMonth (only Year) and PolicyType fields, since the users will be slicing those fields.

 

Any solution or idea would be amazing! Thank you!!

 

 

 

 

 

 

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @orlandopowerbi,

>>I would like to keep slicing capability of the TenureStartYearMonth (only Year) and PolicyType fields, since the users will be slicing those fields.

I'd like to suggest you take a look at the following blog to use allexcept to replace all functions to exclude specific filter effects.

Managing “all” functions in DAX: ALL, ALLSELECTED, ALLNOBLANKROW, ALLEXCEPT - SQLBI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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