In Rules Engine we do not have date filters in terms of quarters as in report builder, here I came with the workaround on how to do that.
Let us see some use cases that need Quarter as the date filters:
-
Pull the number of unique logins happened in last quarter and create CTA if usage drops
-
Number of meetings CSM had with the customer in the quarter and draw insights about Engagement
-
Number of support tickets raised by the customer in the last quarter and decide the support score based on that.
To solve these use cases, we should be able to filter based on quarters. But since we do not have that we tend to use last 90 days data but might not give the same data unless you are running the rule on the first day of the current quarter.
So, there is simple work around to pick data quarter-wise:
i) To pull the data of previous quarter:
-
From the data set where pull the date fields, do not apply any data filter. Just pull in the date field into the show section.
-
In the next transformation, make use of the date formula “Add/Subtract date” under Formula fields. Let's say if you are running on the fifth of every quarter to pull last quarter’s data.
Subtract five days from rule data and that will give the last day of the previous month/quarter.
4) Now use the formula fields “First day of Calendar quarter” and “Last day of Calendar quarter” in the next transformation from Date formulas.
5) Now populate these fields as filters in the next transformation using option to set up filter based field instead of value.
ii) To pull data based on Current Quarter:
-
Similarly pulling data of the current quarter is simpler than pulling previous quarters. You can directly pull First day of current quarter na dLast day of current quarter in one transformation and use theme as filters in next transformation.
Select “Rule date” so that it gives the first day of quarter based on the day we are running this rule.
-
Apply the filters in the next transformation.
iii) To pull data based on Current and next quarters:
-
Brining the first day of the previous quarter is shown in first case and brining the last day of current quarter is shown in previous case.
-
Using those two derived fields, apply the filters to bring data belonging to previous and current quarters.
Similarly you can modify the date formula “add to Rule date “ and by adding the days to rule data, derive the first and last days of next quarters as well.
Hope this small work around helps in filtering the data in terms of quarters. Meanwhile our Rules team is also working on bringing direct filters for quarters which may eliminate need of this workarounds.