You need to sign in to do that
Don't have an account?
bryansosa01
Aggregate Functuions and Subquery
I want tu SUM the MAX values from an Object
I want to do something like this:
SELECT sum(max(Exposici_n__c)) FROM Cartera_de_Credito__c WHERE Fecha_al__c = 2013-06-30 Group BY Banda_2__c ORDER BY Max(Banda__c)
Please help.
Bryan Sosa.
Hi Bryan,
Where do you want this output?
If you want want this output it can be show using reports and summary fields formula (on reports)
Report route:-
Create summary report group by Banda_2__c
Then add a summary formula on report which brings within each grouping
As you create such a field you can have summation at all levels.
Hope this helps
Thanks for your answer,
I want to save the SUM into a field of a record of another object that is not related. The report would not work.
Thanks for your help.
Use a AggregateResult list and iterate it in a loop, use a variable to sum the MAX, then out of the for loop assign the total value from variable to the field.
Does this make sense? Let me know if you want me to give you code snippet (I would highly recommend you to do it yourself :) ).
Thank you very much for your answer,
I really appreciate if you could provide a snippet of code.
Bryan Sosa.