SSRS Expression

  • Hi All,

    I have a date field from 01/08/2010 - 06/06/2011. In my report, I want this date to show as 2010 August or 2011 June respectively based on the value of the date field. Now I have written an expression which doesnt work.

    FormatNumber(Year((Fields!StartDate.value), "####") + " " + Month (Fields!StartDate.value). Can someone help me with the expression.

  • eobiki10 (5/29/2012)


    Hi All,

    I have a date field from 01/08/2010 - 06/06/2011. In my report, I want this date to show as 2010 August or 2011 June respectively based on the value of the date field. Now I have written an expression which doesnt work.

    FormatNumber(Year((Fields!StartDate.value), "####") + " " + Month (Fields!StartDate.value). Can someone help me with the expression.

    You are mixing data types in your expression, and therefore the issues. Try casting all the elements in your expression (which returns numbers) explicitly to a string.

    For example: cstr(FormatNumber...) + " " + Month(...)

    Can't remember whether the "Month" function returns a string or number for the month, so you may have to double-check that.

    Hope this helps.

  • I would think you could just do this:

    =YEAR(Fields!StartDate.value) + " " + MONTHNAME(MONTH(Fields!StartDate.value))

  • Use the VB & instead of SQL + to concatenate in SSRS expression.

    [font="Courier New"]Looking for a Deadlock Victim Support Group..[/font]
  • You may try:

    CDate(Fields!StartDate.Value.ToString()).ToString("yyyy-MMMM")

    Cheers,

    Hope this helps,
    Rock from VbCity

  • Thanks folks. The one that I tried earlier that worked is =YEAR(Fields!StartDate.value) & " " & MONTHNAME(MONTH(Fields!StartDate.value))

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply