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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kfortenberry
Frequent Visitor

Calculate Years of Policy Retention

I would appreciate any assistance to create a new measure to calculate the years of policy retention by policy number for the following sample data. 

 

For each unique policy number, there may be several transactions entered for a particular policy year, but I would like a total count of each unique effective date for each policy number.

 

In this sample data, I would expect 2875 to return a count of 3, 3294 would return a  count of 4 and 7236 would return a count of 4.

 

Policy NumberEffective Date Transaction Amount 
28752/1/2020 $                          20.00
28752/1/2020 $                          30.00
28752/1/2020 $                          25.00
28752/1/2021 $                          45.00
28752/1/2022 $                          50.00
32944/15/2021 $                          22.00
32944/15/2022 $                          13.00
32944/15/2022 $                          72.00
32944/15/2022 $                          55.00
32944/15/2023 $                          30.00
32944/15/2023 $                          45.00
32944/15/2024 $                          60.00
72362/1/2018 $                          19.00
72362/1/2019 $                          43.00
72362/1/2019 $                          23.00
72362/1/2019 $                          25.00
72362/1/2020 $                          40.00
72362/1/2020 $                          17.00
72362/1/2021 $                            5.00
72362/1/2021 $                          64.00

 

As different policy numbers may have the same effective dates, I cannot simply count distinct effective dates and compare to distinct policy numbers. I am not concerned with gaps in effective dates as if there is a gap the policy number would also change.

 

I will be utlizing this data to provide average policy retention periods on simple cards for avariety of other statistics (such as state, coverage type & profession). 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @kfortenberry ,

 

not so sure if i fully get you. you may try to write a measure like:

measure = 
SUMX(
    VALUES(data[policy number]),
    CALCULATE(DISTINCTCOUNT(data[Effective Date]))
)

 

it worked like:

FreemanZ_0-1710386319242.png

 

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

hi @kfortenberry ,

 

not so sure if i fully get you. you may try to write a measure like:

measure = 
SUMX(
    VALUES(data[policy number]),
    CALCULATE(DISTINCTCOUNT(data[Effective Date]))
)

 

it worked like:

FreemanZ_0-1710386319242.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.