---
schema_version: "1"
id: 84a55d90c74f9e37ef531b92ffc81be5898b9386129c46e5b3fd985d013ad0cd
title: Display the Opportunities Closed This Month
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/reference/bi-saql-functions-date-examples.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-date-examples.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ae8938e7d66cdbcd806340c21a0380fbd96d373bba9a0a0c1aaf1359248cb6cc
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# 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.](https://developer.salesforce.com/media/bi_dev_guide_saql/bi_saql_dates_data.png)

Use `date()` to generate the close date in date format. Then use relative date ranges to filter opportunities closed in the current month.

```nolang
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.](https://developer.salesforce.com/media/bi_dev_guide_saql/bi_saql_date_closed.png)

To add the close date in a readable format, use `toDate()`.

```nolang
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.](https://developer.salesforce.com/media/bi_dev_guide_saql/bi_saql_date_example_result1.png)

You can also display just the month and day of the close date.

```nolang
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.](https://developer.salesforce.com/media/bi_dev_guide_saql/bi_saql_date_example_result.png)

**See Also**

- [Time-Based Filtering](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-daterange.md)
