Symptom
- In Crystal Reports, the date of the last day of the previous month is required in a formula. For example, if the current date is April 14 the formula needs to return March 31.
- How can you display the date of the last day of the previous month?
Environment
- SAP Crystal Reports 2016
- SAP Crystal Reports 2020
- SAP Crystal Reports 2025
Resolution
- To determine the date of the last day of the previous month, create a formula, and either use the function: DateAdd, or LastFullMonth:
- Formula using the function DateAdd:
DateAdd ("d", - (Day(CurrentDate)), CurrentDate)
Note: This formula determines the current day of the month and subtracts it from the current date to return the date of the last day of the previous month. - Formula using the function LastFullMonth:
Maximum(LastFullMonth)
Note: LastFullMonth is a Crystal Reports function that specifies a range of Date values that includes all dates from the first to last day of the previous month. Maximum is a Crystal Reports function that enables you to find the maximum value that appears in a set of values.
Keywords
DATE DAY PREVIOUS MONTH LAST END FORMULA FUNCTION CALCULATE DIFFERENCE Crystal Reports Date fields Formulas that calculate date differences Day, DateAdd, CurrentDate functions , c2011714 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To
Product
SAP Crystal Reports 2016 ; SAP Crystal Reports 2020 ; SAP Crystal Reports 2025
SAP Knowledge Base Article - Public