Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expiration Date Calculations Required for MVP #83

Open
tobiasaw34002 opened this issue Mar 7, 2023 · 4 comments
Open

Expiration Date Calculations Required for MVP #83

tobiasaw34002 opened this issue Mar 7, 2023 · 4 comments
Assignees

Comments

@tobiasaw34002
Copy link
Contributor

What are the most common scenarios for organizations calculating expiration dates and which of those scenarios should be included in an MVP?

Examples:

  1. Today + 365 days
  2. Today's date next year (e.g. 03/06/2023 to 03/06/2024)*
  3. Today + 365 days rounded to the end of the month (e.g. 03/06/2023 to 03/31/2023)*
  4. Calendar Year
  5. Fiscal Year (e.g. July 1 - June 30)

*Considerations needed for Feb. 29/leap years

@DebbieN-SF
Copy link
Contributor

DebbieN-SF commented Mar 16, 2023

We have two schemes, one that uses logic from 2, and another that uses logic May 1- April 30 (our fiscal year is April 1 - March 31)
i.e. With annual start date 1st May, paying April to Feb is this year but March is counted as next year.

Here are my flow calculations if they help understand the logic.

Start Date:
IF(ISPICKVAL({!$Record.npe01__Member_Level__c},"Life"),{!$Record.CloseDate},
IF(AND(ISPICKVAL({!$Record.npe01__Member_Level__c},"Affiliate") ,MONTH({!$Record.CloseDate})>=4), DATEVALUE(TEXT(YEAR({!$Record.CloseDate}))+"-05-01"),
IF(AND(ISPICKVAL({!$Record.npe01__Member_Level__c},"Affiliate") ,MONTH({!$Record.CloseDate})<3), DATEVALUE(TEXT(YEAR({!$Record.CloseDate})-1)+"-05-01"),
IF(AND(ISPICKVAL({!$Record.npe01__Member_Level__c},"Affiliate") ,MONTH({!$Record.CloseDate})=3), {!$Record.CloseDate},
IF(OR(ISBLANK({!$Record.Member_Date_Check__c}),ISPICKVAL({!$Record.npe01__Membership_Origin__c},"New")),{!$Record.CloseDate},
IF(AND({!$Record.Member_Date_Check__c}-{!$Record.CloseDate}<60, {!$Record.Member_Date_Check__c}-{!$Record.CloseDate}>-60),{!$Record.Member_Date_Check__c}, {!$Record.CloseDate}))))))

End Date:
IF(ISPICKVAL({!$Record.npe01__Member_Level__c},"Life"),ADDMONTHS({!$Record.CloseDate},1200),
IF(AND(ISPICKVAL({!$Record.npe01__Member_Level__c},"Affiliate") ,MONTH({!$Record.CloseDate})>=3), DATEVALUE(TEXT(YEAR({!$Record.CloseDate})+1)+"-05-01"),
IF(AND(ISPICKVAL({!$Record.npe01__Member_Level__c},"Affiliate") ,MONTH({!$Record.CloseDate})<3), DATEVALUE(TEXT(YEAR({!$Record.CloseDate}))+"-05-01"),
ADDMONTHS({!$Record.npe01__Membership_Start_Date__c},12))))

@Kathy-Waterworth
Copy link
Contributor

In one use case I have (and not listed above), the membership is Dec 31 of the current year. However, if they pay after October 1, the expiration date becomes Dec 31 of the following year.
This is part of the formula used in a flow for this calculation:
IF(
MONTH ({!$Flow.CurrentDate} ) < 10,
DATE(YEAR({!$Flow.CurrentDate}), 12,31),
DATE((YEAR({!$Flow.CurrentDate})+1),12,31))

@DebbieN-SF
Copy link
Contributor

DebbieN-SF commented Mar 29, 2023 via email

@tobiasaw34002
Copy link
Contributor Author

tobiasaw34002 commented Mar 30, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants