Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 820 | Views in the last 30 days: 15
 
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

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones