Current Quarter and Last Quarter calculation in Rules Engine

Related products: CS Rules & Permissions

 

I believe the Easiest way to find Quarter based calculation in Rules are like this.

Current Quarter 

Use case : Want to ingest sum of Forecast amount for Current Quarter 

Show fields : Opportunity Amount, Opp GSID, Close Date

Transformation:

Sum of Amount
 GSID
[Date Forumula] → First Day of Calendar Quarter(Closed Date)
[Date Forumula] → Last Day of Calendar Quarter (Closed Date)

Based on Closed date it would create two fields, You can ingest these two fields in GS Opportunity Object.

Now if you want to know GS opportunities got closed in Current Quarter, Here is how you can apply the filter to your fetch.

 

First Date of Calendar Quarter <= Rule Date
Last Date of Calendar Quarter >= Rule Date

It will pull up the opportunities closed in Current Quarter.

 

Last Quarter 

Use Case: Want to ingest sum of Forecast amount for Last Quarter

Show field : Opportunity amount, GSID, Closed Date, First Day of Calendar Quarter, Last Day of Calendar Quarter [ These two fields are coming from previous rule run (Date ingestion)]

Transformation : Sum of Amount 
GSID
Date Fomula : Ad/Sub Date

Last Day of Last Quarter = Add/Subtract Date(First Day of Calendar Quarter,- (Minus),1,Days)

First Day of Last Quarter = Add/Subtract Date(First Day of Calendar Quarter, -(Minus),90, Days)

Minus 90 days may not be correct as some quarters are of 91,89 days also hence we need to add one more transformation to get exact value for First Day of Last Quarter

Transformation: 

Date formula (First day of Current month) will be used

First Day of Last Quarter = First Day of Current Month(First Day of Last Quarter)

It will get proper 1st Day of Last Quarter.

 

These values again can be ingested in GS opportunity object by creating two separate field.

 

To find out Sum of forecasted amount closed in Last quarter.

 

Closed Date >= First Day of Last Quarter

Closed Date <= Last Day of Last Quarter

Hope that helps.

 

Correction :
Current Quarter 

Use case : Want to ingest sum of Forecast amount for Current Quarter 

Show fields : Opportunity Amount, Opp GSID, Close Date

Transformation:

Sum of Amount
 GSID
[Date Forumula] → First Day of Calendar Quarter (Rule Date)<---
[Date Forumula] → Last Day of Calendar Quarter (Rule Date)<---