AnsweredAssumed Answered

How do I calculate name of previous quarter?

Question asked by basilisk2 on Sep 9, 2014
Latest reply on Sep 10, 2014 by basilisk2

Title

How do I calculate name of previous quarter?

Post

I am using the Set Field script step to automatically set the date of one of two comparison dates. I can successfully set the current quarter [sjClientInfo::gQuarterTwo], but not the previous quarter [sjClientInfo::gQuarterTwo].

The following code sets the field to the last last quarter of the last calendar year which is OK if the current quarter is Q1, but not for Q2, 3 or 4. How do I change this please?

Set Field [sjClientInfo::gQuarterOne; Let ( T = Get ( CurrentDate ) ; If ( Ceiling ( Month ( T ) / 3 ) = 1 ; Year ( T ) -2 & " Q4" ; Year ( T ) - 1  & " Q4" ) )

TIA!

Outcomes