This question runs in a pre-configured Salesforce environment - no personal connection required.
Calculate Total Revenue by Industry
Write a method that calculates the total AnnualRevenue for each Industry from the Account object. Return a Map where the key is the Industry name (String) and the value is the total revenue (Decimal) for that industry. Only include industries where at least one account has a non-null AnnualRevenue value.
Method Signature:
public static Map<String, Decimal> getRevenueByIndustry()
Examples:
Input: No parameters
Output: {'Technology' => 45000000, 'Finance' => 30000000, 'Healthcare' => 15000000}
Explanation: The Technology industry has a total of 45 million in revenue across all accounts, Finance has 30 million, and Healthcare has 15 million
Input: No parameters
Output: {'Manufacturing' => 80000000}
Explanation: If only Manufacturing accounts have non-null revenue values, only Manufacturing appears in the result with the sum of all Manufacturing account revenues
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 July 2026
Contest runs July 1 - 31. Complete challenges to climb the leaderboard!
Only the 31 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.