I am trying to convert numeric months to text in SSRS Report Builder. I am having trouble with the expression needed to make this work. Here is the expression I have:
=IIF(Fields!MonthYear.Value = 6, "June" ,
IIF(Fields!MonthYear.Value = 7, "July" ,
IIF(Fields!MonthYear.Value = 8, "August" ,
IIF(Fields!MonthYear.Value = 9, "September" ,
IIF(Fields!MonthYear.Value = 10, "October")))))
This code throws the error: "The Value expression for the textrun ‘MonthYear.Paragraphs[0].TextRuns[0]’ contains an error: [BC30516] Overload resolution failed because no accessible 'IIf' accepts this number of arguments."
If there is a much simpler way to do this, I am all ears!
SWITCH()is normally much easier than nestedIIFs, it much easier to read. So you can easily convert to this..SWITCHuses pairs of expression/return value. The finalTruejust acts like an else if the previous entries all returned false (e.g. MonthYear = 11)As a simple example, I created a dataset with the folloing query
Then I added a table, set the first column to the the MonthYear field and the second column used the expression above.
This is the result which is as expected.