Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Last month Name and Year in a SSRS expression

By Jeff Ridings,

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

Total article views: 1124 | Views in the last 30 days: 7
 
Related Articles
FORUM

Expression

Expression

FORUM

Expressions for Variables

Expressions

ARTICLE

Get month names ordered using recursion

Learn how to pull the month names in a report drop down using a recursive common table expression (C...

FORUM

last day of the month parameter in ssrs

find the last day of the previous month within ssrs parameter using expression builder

FORUM

how to change expression

how to change expression

Tags
dateadd    
monthname    
reporting services (ssrs)    
year    
 
Contribute