How can I create a variable for the aggregateresult addedserviceresults that would show in a Visualforce table as a column % for each Franchise_Added_Service__r.Group__c out of the value from a second aggregateresult inspections.['c']? So for example, if the group is Radon and there are 7 records, and the count of records in the inspections aggregate result is 10, I would want to show 70% for this row in the table, but if the service is WDI (2 records), I would want to show 20%, and so on...
public AggregateResult[] inspections {
get {
return [SELECT Count(id) c,Sum(Number_of_Home_Inspections__c) HomeInspections, Sum(Home_Inspection_dollars__c) Dollars, Franchise__c,
Sum(Plus_Sales__c) plus_dollars, Sum(Premium_Sales__c) premium_dollars, Sum(Prestige_Sales__c) prestige_dollars,
Sum(of_Plus_Sales__c) plus_count, Sum(of_Premium_Sales__c) premium_count, Sum(of_Prestige_Sales__c) prestige_count,
Sum(Added_Services__c) addedservices, Sum(Standalones__c) standalones
FROM Inspection__c
WHERE Test_Inspection__c = false AND Status__c = 'Completed' AND Franchise__c =: accountid
GROUP BY Franchise__c];
}
}
public AggregateResult[] AddedServiceResults {
get {
return [SELECT Count(Id) Total, Sum(Price_Sold__c) Dollars,Franchise_Added_Service__r.Group__c a
FROM Inspection_Service__c
WHERE Inspection__r.Status__c = 'Completed' AND Inspection__r.Test_Inspection__c = false AND Inspection_Franchise__c =: accountid
GROUP BY Franchise_Added_Service__r.Group__c];
}
}