Database
[{doc_id:1.0,name:"x",l1:3},{doc_id:1.0,name:"x",l1:2},{doc_id:1.0,name:"x",l1:1},]
Query
db.collection.aggregate([{"$match":{"doc_id":1.0}},{"$group":{"_id":{"name":"$name"},"total":{"$sum":"$amount"},"l1_max":{"$max":"$l1"},"l1_values":{$push:"$l1"}}},{$project:{_id:1,total:1,l1_max:1,l1_perc:{$divide:[{$size:{$filter:{input:"$l1_values",cond:{$eq:["$$this","$l1_max"]}}}},{$size:"$l1_values"}]}}}])