Top N with stacked bar chart question

I’m using Metabase 0.24 with CrateDB and I’m trying to create a stacked bar chart. I’m summing dollar amounts and when I group by a single variable everything works fine. When I group by two variables, the results are inconsistent. Below is the SQL. I want all project types for the top ten departments by sum of amount. Instead, I’m getting the top 10 project types. That drops some project types for the top 10. How can I visualize all project types for the departments with the top ten highest amounts?

Thanks.

Brandon

SELECT sum(“doc”.“data16”.“Amount”) AS “sum”, “doc”.“data16”.“department_name”, “doc”.“data16”.“project_type”
FROM “doc”.“data16”
GROUP BY “doc”.“data16”.“department_name”, “doc”.“data16”.“project_type”
ORDER BY “sum” DESC
LIMIT 10