Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

About the SSRS Perameter Expression Expand / Collapse
Author
Message
Posted Wednesday, October 16, 2013 10:25 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 29, 2014 11:20 AM
Points: 9, Visits: 30
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
Post #1505327
Posted Wednesday, October 16, 2013 1:03 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Thursday, December 11, 2014 2:11 PM
Points: 3,220, Visits: 1,399
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
Post #1505389
Posted Thursday, October 17, 2013 6:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, April 29, 2014 11:20 AM
Points: 9, Visits: 30
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
Post #1505672
Posted Thursday, October 17, 2013 7:13 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, December 24, 2014 8:23 AM
Points: 2,818, Visits: 2,569
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
Post #1505691
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse