Preview:
select  Opportunity__r.Country_of_Ownership__c,  CALENDAR_MONTH(Transaction_Allocation__c.Close_Date__c) Months,  CALENDAR_YEAR(Transaction_Allocation__c.Close_Date__c) Years, 
 sum(Transaction_Allocation__c.Amount__c) amount,
  AVG(Transaction_Allocation__c.Amount__c) averages,
  COUNT_DISTINCT(Opportunity__r.Id) The_Count
  
from Transaction_Allocation__c
 
where 
((Transaction_Allocation__c.Close_Date__c  > 2022-03-31 AND Transaction_Allocation__c.Close_Date__c  < NEXT_N_DAYS:1)
AND
Transaction_Allocation__c.GL_Code__c IN ('50030','50090')
AND
Transaction_Allocation__c.Stage__c IN ('Posted','Refunded','Failed','Refund','Reversal'))

AND
((
Opportunity__r.RecordTypeId IN ('012w00000006jGy')

 AND
 Opportunity__r.Recurring_Donation_Installment_Period__c = 'Monthly'
)
OR
(Opportunity__r.RecordTypeId IN ('0122X000000ie1A') 
AND Opportunity__r.CiWF_Payment_Method__c IN ('Paypal')

))
 


 
 
Group by CALENDAR_MONTH(Transaction_Allocation__c.Close_Date__c), Opportunity__r.Country_of_Ownership__c, CALENDAR_YEAR(Transaction_Allocation__c.Close_Date__c)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter