Wins This Calendar Year

Basic

The year-to-date bookings slide lists every deal won since 1 January.

Return the Name of every Opportunity in stage Closed Won whose CloseDate is in the current calendar year.

Sample data

Opportunity 4 records

NameStageNameAmountCloseDate
Atlas renewalClosed Won40,000today
Beacon pilotClosed Won20,000today - 400 days
Cobalt rolloutProspecting90,000today
Delta expansionClosed Won55,000today

Expected result on the sample

Name
Atlas renewal
Delta expansion

Row order does not matter. Only the columns above are compared; extra columns in your SELECT are fine.

Hints
  • CloseDate = THIS_YEAR matches any date in the current calendar year.
  • Do not forget the stage filter.

What this tests

Date literals such as THIS_YEAR, LAST_N_DAYS:30 and NEXT_QUARTER are resolved by the platform at run time, so the query never needs date arithmetic in Apex and never goes stale. THIS_YEAR is the calendar year; the fiscal versions are THIS_FISCAL_YEAR and friends.

SOQL

Run on sample executes your query against the sample data shown on the left and displays the rows it returns. Submit checks it against the sample plus 2 hidden datasets, comparing your rows with the expected rows on each. Queries run in a real Salesforce org; the data is inserted for your run and rolled back afterwards.