You can query a query. You can get results of first with some derived columns(alias), Second set of results you could wrap that in another select, selecting The derived Columns you need.
See https://laracasts.com/discuss/channels/eloquent/calculate-average-of-multiple-fields-eloquent example of querying a query.