SSRS EXPRESSION TO USE IN REPORT HEADER

  • I would like to display the date in an expression field which will be dependent on a parameter @months.
    the report picks up values based upon the number of months entered from the current date.
    if the months entered is 6 i would like the FROM parameter expression  to show the 
    the first day of the month which is 6 months prior, if 8 is entered it will be 8 months prior.
    i have the following below, but i know it is not correct.
    ="FROM :" & iif(Parameters!MONTHS.Value > 0,Format(DateAdd("h",-12,Now()),"MM/dd/yyyy hh:00 tt")

    hoping for a little help!!!

  • Maybe:
    ="FROM " & FORMAT(DATEADD("M", 0 - Parameters!MONTHS.Value, DATEADD("M", DATEDIFF("M", "01/01/2000", TODAY()), "01/01/2000")), "MM/dd/yyyy hh:00 tt")
    Note this will always round to the start of the month, at midnight. So, for example, a value of 1 for the parameter MONTHS today would give 01/01/2017 12:00 am.

    P.s. Sorry I didn't test the above, wrote from memory.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

Viewing 2 posts - 1 through 1 (of 1 total)

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