Crystal Reports: Display Month Name and Year of Last Month [Field Notes]

less than 1 minute read | Suggest an edit | Issue? Question?


A report I’m running gets the data for the last Month. I’d like to nicely display the name of the month and year.


Step 1: Formula to Return the Date 1 Month Ago

Use the DateAdd function in the formula to get the date minus one month:

DateAdd("m", -1, CurrentDate)

This says to use “month” intervals, subtract one, and use the current date as the starting point.

Step 2: Display the Month Name and Year of the Date Formula

MonthName(Month({@DateMinusOneMonth})) + " " + ToText((Year({@DateMinusOneMonth})), 0, "")

This concatenates a string of the month name for the formula and the year for the formula. The part that calculates the year also notes that there should be no comma for thousands and no decimals (year here is being interpreted as just a number when outputted to ToText).


Leave a comment