Existing Base other regular giving income

PHOTO EMBED

Tue Aug 16 2022 11:05:13 GMT+0000 (Coordinated Universal Time)

Saved by @Matt_Stone #gigkpi

select
sum(Transaction_Allocation__c.Amount__c) amount, COUNT_DISTINCT(Opportunity__r.Id) The_Count, Opportunity__r.CiWF_Payment_Method__c, Opportunity__r.Country_of_Ownership__c, Opportunity__r.CurrencyIsoCode, CALENDAR_MONTH(Transaction_Allocation__c.Close_Date__c) Months,  CALENDAR_YEAR(Transaction_Allocation__c.Close_Date__c) Years
 
from Transaction_Allocation__c
where 
(
  Transaction_Allocation__c.Stage__c IN ('Posted','Refunded','Failed','Refund','Reversal')
 
AND
  
     (Transaction_Allocation__c.Close_Date__c  > 2022-03-31 AND                Transaction_Allocation__c.Close_Date__c  < NEXT_N_DAYS:1) 
AND
Opportunity__r.Direct_Regular_Donor_Start_of_FY__c = True
 
AND
   
 Opportunity__r.RecordTypeId IN ('0122X000000ie1A')
 
        AND
Opportunity__r.CiWF_Payment_Method__c !='Paypal'
 
AND Transaction_Allocation__c.GL_Code__c IN ('50030','50090')
 )
 
 
Group by Opportunity__r.CiWF_Payment_Method__c, Opportunity__r.Country_of_Ownership__c,Opportunity__r.CurrencyIsoCode, CALENDAR_MONTH(Transaction_Allocation__c.Close_Date__c),CALENDAR_YEAR(Transaction_Allocation__c.Close_Date__c)
content_copyCOPY