Technical Article

Last month Name and Year in a SSRS expression

,

Use in a text box expression over a column(s) of related data you want grouped together.

If you want the text to change based on a parameter called AsOfDate, that will show the last full month month name and year. Use this formula in the expression.

=MonthName(Month(DateAdd("M",-1,Parameters!AsOfDate.Value)))& "  "& (Year(DateAdd("Y",-1,Parameters!AsOfDate.Value)))

for example if the AsofDate = 10/15/2010

the expression returns

September 2010

In SSRS you must format the Text Box to be Number - Date - January, 2000

=MonthName(Month(DateAdd("M",-1,Parameters!AsOfDate.Value)))& " "& (Year(DateAdd("Y",-1,Parameters!AsOfDate.Value)))

Rate

4.33 (3)

You rated this post out of 5. Change rating

Share

Share

Rate

4.33 (3)

You rated this post out of 5. Change rating