This question runs in a pre-configured Salesforce environment - no personal connection required.

Return the total Amount of all open opportunities, where an opportunity is open when IsClosed is false. Use a SOQL aggregate SUM query. Return 0 if the sum is null.

Example 1:

Input: (query all open opportunities) Output: 4250000.00 Explanation: The sum of Amount across all opportunities where IsClosed is false is returned as a Decimal.

Example 2:

Input: (only closed opportunities exist) Output: 0 Explanation: When no open opportunities have amounts, the aggregate SUM returns null and the method returns 0.

Example 3:

Input: (some open, some closed) Output: 1800000.00 Explanation: Only opportunities where IsClosed is false contribute to the sum. Closed opportunities are excluded.
Apex Code Editor

Welcome to Lightning Challenge!

How It Works

  • • Write your solution in the code editor
  • • This challenge runs without connecting your own org
  • • Submit to check if your solution passes
  • • Use hints if you get stuck

Contest Alert

🏆 #CodeEveryDay September 2026 (Sep 1–15)Sponsored by FLXBL

Contest runs September 1 - 15. Complete challenges to climb the leaderboard!

1st & 2nd: Salesforce certification exam voucher see all prizes

Only the 15 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In