try the following as your expression:
//0 = grand total
dimensionality() > 0
sum(aggr(sum(DISTINCT amount), Category))
On a detail-level you only have one amount, so that will stay unchanged.
On category-level a sum will be made on the distinct values within that category
On the grand total the sum(aggr(... will make the summation of the category-level subtotals