=count(if(Code<>10015,Code)) / count(Distinct daystart(Date))
as your expression, doing the if() inside the aggregation count should also solve your issue regarding the needed Code dimension.
I would suggest that your create new fields for year, month, etc. also for a real Date using daystart(Date), since your Dates are Timestamps.
Hope this helps,
edit: from your app, I assumed you wanted to count all codes except 10015, but if it's the other way round, just use
count(if(Code=10015,Code)) / count(Distinct daystart(Date))