Nimchip
Nimchip

Reputation: 1735

SSRS is month greater than number

I have the following code which is failing

=IIF(Parameters!yearFormat.Value="fiscalYear", 
"FISCAL YEAR: " & IIF(Month(NOW()) > 6, Year(NOW())+1, Year(NOW())), 
"NATURAL YEAR: " & Year(NOW()))

The error i get is #error and I also get this warning:

[rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox23.Paragraphs[0].TextRuns[0]’ contains an error: Input string was not in a correct format.

What am I doing wrong here?

Upvotes: 0

Views: 29

Answers (1)

Ross Bush
Ross Bush

Reputation: 15175

You are mixing strings with integers without a cast.

Try using CStr() to convert an integer to a string:

=IIF(Parameters!yearFormat.Value="fiscalYear", 
"FISCAL YEAR: " & IIF(Month(NOW()) > 6, CStr(Year(NOW())+1), CStr(Year(NOW()))), 
"NATURAL YEAR: " & CStr(Year(NOW())))

Upvotes: 1

Related Questions