I solved this challenge differently. I searched through the community and I found one good solution. The solutions are different. So I decided to share.
WITH
customer_by_country AS(
SELECT country,
first_name || ' ' || last_name customer_name,
customer_id
FROM customer
),
total_purchased_by_customer AS(
SELECT cbc.country,
cbc.customer_name,
SUM(inv.total) total_purchased
FROM customer_by_country cbc
INNER JOIN invoice inv ON inv.customer_id = cbc.customer_id
GROUP BY inv.customer_id)
SELECT * FROM total_purchased_by_customer
GROUP BY 1
HAVING total_purchased = MAX(total_purchased)
ORDER BY 1;