January 15, 2015 at 9:14 am
I have a requirement in ssrs report to display previous business day date in expression.I am using the below sql in sql server to display date
DATEADD(DAY, CASE DATENAME(WEEKDAY, GETDATE())
WHEN 'Sunday' THEN -2
WHEN 'Monday' THEN -3
ELSE -1 END, DATEDIFF(DAY, 0, GETDATE()))
can some help me with the similar code to display previous business day(just date) in ssrs expression ?
January 16, 2015 at 9:28 am
What are you going to do when there's a holiday on a business day? Just looking to create the equivalent in an SSRS expression isn't going to solve that problem. I, for one, would never use an expression to do this, as it makes much more sense to include the necessary data in your Dataset, based on having created a holiday table and the necessary code to support taking that into account. FYI, if for whatever reason, the holidays just don't matter, then it's not that difficult to navigate through the possible date & time functions available when you're in an expression editor, and find the DATEDIFF and WEEKDAY functionality there. The IIf or Switch functions can help you with setting up the equivalent for your CASE statement. Give that a try, and if you get stuck, post what you tried and I can help from there.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply