Display the Opportunities Closed This Month

Use relative date ranges to filter opportunities closed in the current month.

Example: Display Opportunities Closed This Month

Suppose that you want to see which opportunities closed this month. Your data includes the account name, the close date fields, and the epoch seconds field.

Diagram showing the number of days each account has been opened for.

Use date() to generate the close date in date format. Then use relative date ranges to filter opportunities closed in the current month.

q = load "OpsDates1";
q = filter q by date(’CloseDate_Year’, ‘CloseDate_Month’, ‘CloseDate_Day’) in ["current month" .. "current month"];
q = foreach q generate Account;

If the query is run in May 2018, the resulting data stream contains one entry:

Screenshot displaying opportunities closed in the current month, with seconds epoch time.

To add the close date in a readable format, use toDate().

q = load "OpsDates1";
q = filter q by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["current month" .. "current month"];
q = foreach q generate Account, toDate('CloseDate_sec_epoch') as 'Close Date';

The resulting data stream includes the full date and time of the close date.

Screenshot displaying opportunities closed in the current month, with seconds epoch.

You can also display just the month and day of the close date.

q = load "OpsDates1";
q = filter q by date('CloseDate_Year', 'CloseDate_Month', 'CloseDate_Day') in ["current month" .. "current month"];
q = foreach q generate Account, 'CloseDate_Month' + "/" + 'CloseDate_Day' as 'Close Date';

The resulting data stream contains the month and day of the close date.

Screenshot displaying opportunities closed in the current month, with close date and day.