Skip to main content
Hi,

I'm trying to get an Account list that has an aggregated opportunity total by each qtr/year.  So for example,  it might look something like

Account    2015 Q1     2015 Q2     2015 Q3

AccountA    50000         25000          75000

AccountB    22000         66000          28000

And I know how to use the aggregate result to get quarters and fiscal years, how to get the qtrs and years to go horitontally as described instead of veritally in a database format.

 

aggOppList = [SELECT account.Name, sum(amount) TotalAmount, FISCAL_QUARTER(closedate) qtr, FISCAL_Year(closedate) year

FROM Opportunity WHERE accountID IN :acctList GROUP By account.name, FISCAL_QUARTER(closedate), FISCAL_YEAR(closedate)];

Thanks,
1 risposta
0/9000