This code recipe allows you to specify how far into a term you are and set your level to expire based on the time remaining. This was originally created for a site related to pregnancies, but it can be adapted for various uses.
For example, a member with a 9-month total term can specify that they are 2 months in. Then, the expiration date would be set for 7 months from now.
Note that if you are using Paid Memberships Pro V2.9+, you can create the terms
custom field using the User Fields settings page.

The Code Recipe (PHP)
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.