total amount of all the transactions inputs - total amount of all the transactions outputs
nb of transactions
@amishmanish, I think this post may have addressed your concerns as well...
If you are just calculating from the mempool then it becomes unrelated to the actual set of transactions you want to affect price-wise. This continuous variation also puts another set of calculations, consensus requirement and propagation delays for the miners to calculate, especially if you talk about adjusting size in every block. I don't think this is feasible.
--snip--
In continuation of this, it just occurred to me that any attempt at dynamically calculating the "miner fees" based on mempool transactions will automatically open up the network to all sort of nuisance attacks.
Not sure if I am thinking this correctly but a malicious actor could simply spam the chain with hundreds and thousands of transactions with bare minimum fee. The transactions just stay there, never being picked due to the very low fees and screwing up your calculations. You end up making an elegantly sybil-resistance system welcoming to the most basic of sybil attacks and manipulation.