About the SSRS Perameter Expression

  • what expression Should i use to get the last month last week range .

    for example

    if the current month is october

    So I want in my date and time perameter

    range which shows 09/23/2013 - 09/30/2013

    Can Anyone help me with this ?

    Thanks

  • Could you please clarify the requirement? The example you gave covers 8 days inclusive 23rd to 30th. Do you want the last 8 days, from the last Monday of the month, need more info?

    Also are you looking for a SSRS code query or TSQL query?

    Fitz

  • Hi Fitz,

    My mistake. I want last month 7 days which is from 24 to 30th. and if the month has 31 days then 25 to 31.

    and I want to use that as a parameter in the SSRS code or expression if you can.

    thanks

  • For the beginning of your date range use

    =DATEADD("d",-7,DATEADD("m",DATEDIFF("m","1900-01-01",Today() ),"1900-01-01"))

    For the end of your date range use

    =DATEADD("d",-1,DATEADD("m",DATEDIFF("m","1900-01-01",Today() ),"1900-01-01"))

    As a bit of an explanation, This will return the first day of the month (at midnight)

    DATEADD("m",DATEDIFF("m","1900-01-01",Today() ),"1900-01-01")

    Then all you do is add

    DATEADD("d",-7, and a closing ) at the end

    or

    DATEADD("d",-1, and a closing ) at the end

    to get the date you want

Viewing 4 posts - 1 through 3 (of 3 total)

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