Current Quarter

• Jeff Moden - Monday, November 27, 2017 9:05 PM

drew.allen - Monday, November 27, 2017 10:33 AM

craig.jenkins - Monday, November 27, 2017 9:28 AM

Great thank you Thom A.  Which part does  if '1st  day of the the new quarter then show the last quarter - where is this in the code?' Many thanks appreciate it

This is what I meant about changing the perspective.  You described your issue from the perspective of today:  If today is the first day of the quarter use the last quarter (that is use yesterday's quarter), otherwise use today's quarter( which will also be the same as yesterday's quarter unless today is the first day of the quarter ).  This caused you to need different conditions depending on whether it was the first day of the quarter.  By changing your perspective, this can be simplified because you only have one condition: use yesterday's quarter.

So instead of using today as your frame of reference (GETDATE()), use yesterday as your frame of reference (GETDATE() - 1).

craig.jenkins - Monday, November 27, 2017 9:50 AM

Thank very much, i clearly need to do a lot more reading.  Thanks again

You're not going to learn this by reading.  This requires a different way of thinking about the problem.

Drew

Heh... which you can't learn unless you first read. 😉

In order to think outside of the box, you must first realize that you are in a box.

J. Drew Allen