Wins This Calendar Year
Basic SolvedThe 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
| Name | StageName | Amount | CloseDate |
|---|---|---|---|
| Atlas renewal | Closed Won | 40,000 | today |
| Beacon pilot | Closed Won | 20,000 | today - 400 days |
| Cobalt rollout | Prospecting | 90,000 | today |
| Delta expansion | Closed Won | 55,000 | today |
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_YEARmatches 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.
Datasets
Solved on this device only. Sign in with Google to keep your progress across devices.
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.