July 19, 2017 at 7:16 am
Hello Everyone!
Can someone please tell me the expression to get the start and end dates for the next quarter?
Thanks!
July 19, 2017 at 7:27 am
Thom A - Wednesday, July 19, 2017 7:21 AMSELECT DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +1, 0) AS QStart,
DATEADD(DAY, -1, DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +2, 0)) AS QEnd;
Well, that would work if I was using SQL, but I need the expressions in SSRS.
July 19, 2017 at 7:52 am
meichmann - Wednesday, July 19, 2017 7:27 AMThom A - Wednesday, July 19, 2017 7:21 AMSELECT DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +1, 0) AS QStart,
DATEADD(DAY, -1, DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +2, 0)) AS QEnd;Well, that would work if I was using SQL, but I need the expressions in SSRS.
SSRS uses the same syntax, just a little adjustment:=DateAdd(DateInterval.Quarter, DateDiff(DateInterval.Quarter, CDate("01/01/2000"), Today())+1,CDate("01/01/2000"))
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
July 19, 2017 at 8:13 am
Thom A - Wednesday, July 19, 2017 7:52 AMmeichmann - Wednesday, July 19, 2017 7:27 AMThom A - Wednesday, July 19, 2017 7:21 AMSELECT DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +1, 0) AS QStart,
DATEADD(DAY, -1, DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +2, 0)) AS QEnd;Well, that would work if I was using SQL, but I need the expressions in SSRS.
SSRS uses the same syntax, just a little adjustment:
=DateAdd(DateInterval.Quarter, DateDiff(DateInterval.Quarter, CDate("01/01/2000"), Today())+1,CDate("01/01/2000"))
Could you adjust it for the last day please?
July 19, 2017 at 8:19 am
meichmann - Wednesday, July 19, 2017 8:13 AMThom A - Wednesday, July 19, 2017 7:52 AMmeichmann - Wednesday, July 19, 2017 7:27 AMThom A - Wednesday, July 19, 2017 7:21 AMSELECT DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +1, 0) AS QStart,
DATEADD(DAY, -1, DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()) +2, 0)) AS QEnd;Well, that would work if I was using SQL, but I need the expressions in SSRS.
SSRS uses the same syntax, just a little adjustment:
=DateAdd(DateInterval.Quarter, DateDiff(DateInterval.Quarter, CDate("01/01/2000"), Today())+1,CDate("01/01/2000"))
Could you adjust it for the last day please?
I got it....
Dateadd(DateInterval.Day, -1, DateAdd(DateInterval.Quarter, DateDiff(DateInterval.Quarter, CDate("01/01/2000"), Today()) +2, Cdate("01/01/2000")))
Thanks for your help!!!
July 19, 2017 at 8:23 am
meichmann - Wednesday, July 19, 2017 8:19 AMI got it....
Dateadd(DateInterval.Day, -1, DateAdd(DateInterval.Quarter, DateDiff(DateInterval.Quarter, CDate("01/01/2000"), Today()) +2, Cdate("01/01/2000")))
Thanks for your help!!!
Should be +1 not +2. If my "in head" date maths is correct, that would give you a value of 31 March 2018, not 31 December 2017 (which I assume if you goal?).
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
July 19, 2017 at 8:27 am
Thom A - Wednesday, July 19, 2017 8:23 AMmeichmann - Wednesday, July 19, 2017 8:19 AMI got it....
Dateadd(DateInterval.Day, -1, DateAdd(DateInterval.Quarter, DateDiff(DateInterval.Quarter, CDate("01/01/2000"), Today()) +2, Cdate("01/01/2000")))
Thanks for your help!!!
Should be +1 not +2. If my "in head" date maths is correct, that would give you a value of 31 March 2018, not 31 December 2017 (which I assume if you goal?).
Nope, it works fine:) :
July 19, 2017 at 8:35 am
Nope, it works fine:) :
[/quote]
Yep, you're right, my bad date math. Ha! I feel especially silly, as I had +2 in my T-SQL answer. :blush: :hehe:
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
July 19, 2017 at 9:09 am
Thom A - Wednesday, July 19, 2017 8:35 AMmeichmann - Wednesday, July 19, 2017 8:27 AMNope, it works fine:) :
Yep, you're right, my bad date math. Ha! I feel especially silly, as I had +2 in my T-SQL answer. :blush: :hehe:
[/quote]
Ok, how about first and last day of the previous year?
July 19, 2017 at 11:45 am
meichmann - Wednesday, July 19, 2017 9:09 AMThom A - Wednesday, July 19, 2017 8:35 AMmeichmann - Wednesday, July 19, 2017 8:27 AMNope, it works fine:) :
Yep, you're right, my bad date math. Ha!
I feel especially silly, as I had +2 in my T-SQL answer. :blush: :hehe:
Ok, how about first and last day of the previous year?[/quote]
You have the code for next quarter, it is just a matter of making a few changes to what you already have. Play with it, you will learn more that way rather than just asking others.
July 19, 2017 at 11:58 am
Lynn Pettis - Wednesday, July 19, 2017 11:45 AMmeichmann - Wednesday, July 19, 2017 9:09 AMThom A - Wednesday, July 19, 2017 8:35 AMmeichmann - Wednesday, July 19, 2017 8:27 AMNope, it works fine:) :
Yep, you're right, my bad date math. Ha!
I feel especially silly, as I had +2 in my T-SQL answer. :blush: :hehe:
Ok, how about first and last day of the previous year?
You have the code for next quarter, it is just a matter of making a few changes to what you already have. Play with it, you will learn more that way rather than just asking others.
[/quote]
I did and got it, thanks
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy