Adjust Calculating Quarter

Heidestrand

Registered User.
Local time
Today, 09:20
Joined
Apr 21, 2015
Messages
73
Hello community,
I've a short question: I've some code with which I can calculate the quarter from a date:
Code:
sapsys_quarter = "Q" & Format([sapsys_date],'q')
The thing is that "our" first quarter starts on October 1st and not January 1st.
So right now we're in quarter 1 and not quarter 4.

How can I change my code to calculate this?

I appreciate any help :)
 
Last edited:
Something like this:-

4 = 1
1 = 2
2 = 3
3 = 4

IIf ("Q" & Format([sapsys_date],'q')) = 4, 1, ("Q" & Format([sapsys_date],'q')) +1)
 
Or like this:-

If ("Q" & Format([sapsys_date],'q')) = 4 Then
sapsys_quarter = 1
Else
sapsys_quarter = ("Q" & Format([sapsys_date],'q')) +1)
End if
 
Last edited:
Thanks a lot for your great help, Uncle Gizmo! :)

After a lot of attempts I finally got it working for me :)
Code:
UPDATE tblSAPSys
SET sapsys_quarter = IIf (("Q" & Format([sapsys_date],'q')) = "Q4", "Q1", ("Q" & Format([sapsys_date],'q')) +1);
 
Last edited:

Users who are viewing this thread

Back
Top Bottom