I figured out, that i need the percentiles function to extract the median. Still, i don't really get a result. I want to find out how many mails are filed on average without the outlier distorting the result. The customDimensions.AmountStored contains the information about how many mails got stored.
I'm using this query:
AllShards_CustomEvents
| where name == "Mail.Implementation.StoreCount"
| extend storeCount = toint(customDimensions.AmountStored)
| project timestamp, shard=tostring(customDimensions.ShardName), storeCount
| summarize percentiles(storeCount, 5, 50, 95) by bin(timestamp, 7d), shard