MAX(amount) keeps the largest non-NULL amount value inside each category group.
highlighted = computed this step
Input table
Use the same sales rows with one NULL amount.
Group query
Group by category and take the largest non-NULL amount.
GROUP BY category, MAX(amount)
Grouped output
The NULL amount is skipped, so the pen maximum is the largest known amount.
maximum amounts by category