Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Dynamic Column Headers?

Author  Topic 

tking1
Starting Member

22 Posts

Posted - 2010-06-25 : 11:55:43
Hi all,

I have a query that pulls data for a rolling 12 month period. The column headers in the query are "Current", "Cur+1", "Cur+2", etc. I'm using a tabular report to display the data, and need the report column headers to show the translated month names, in this manner:
Current = Jun, Cur+1 = Jul, Cur+2 = Aug, etc.

Pretty sure I would accomplish this using an expression in the header text boxes, but what would the syntax for the expression be?

Thanks in advance

tking1
Starting Member

22 Posts

Posted - 2010-06-25 : 14:45:30
Ok, figured it out in case anyone wants to know. The expressions I used for the value of the column headers is "=monthname(month(Today))" then "=monthname(month(Today)+1)" then "=monthname(month(Today)+2)" and so on.

Now my problem is that once it gets to January 2011, which is represented by "=monthname(month(Today)+7)", I get an error "#Error" in my preview.

The output error is:
"[rsRuntimeErrorInExpression] The Value expression for the textbox ‘textbox12’ contains an error: Argument 'Month' is not a valid value."

Can anyone help with this? How do I make it wrap?
Go to Top of Page

tking1
Starting Member

22 Posts

Posted - 2010-06-28 : 12:50:53
Success!! Finally struck the right combo of key words on google and found the solution here: http://msdn.microsoft.com/en-us/library/ms157328.aspx

Here are my expressions:

Current month
=monthname(month(Today))

Next Month
=monthname(month(DateAdd(DateInterval.Month, 1, Today)))

Following Month
=monthname(month(DateAdd(DateInterval.Month, 2, Today)))

and so on.
Go to Top of Page
   

- Advertisement -