Sum(case when type = 'payout' or type like '%transfer%' then amount else 0 end) as gross_payouts, Sum(case when type = 'payout' or type like '%transfer%' then fee * -1.0 else 0 end) as payout_fees, Sum(case when type 'payout' and type not like '%transfer%' then net else 0 end) as net_transactions, Sum(case when type 'payout' and type not like '%transfer%' then amount else 0 end) as gross_transactions, Sum(case when type not in ('charge', 'payment', 'payment_refund', 'refund', 'adjustment', 'payout') and type not like '%transfer%' then amount else 0 end) as other, Sum(case when type = 'adjustment' then amount else 0 end) as adjustments, Sum(case when type in ('payment_refund', 'refund') then amount else 0 end) as refunds, Sum(case when type in ('charge', 'payment') then amount else 0 end) as sales, Note: only months with at least 1 balance transaction will be returnedÄate_trunc('month', case when type = 'payout' then available_on else created end) as month, - payouts are considered when they are posted (available_on) balance_transaction types on a monthly basis for each currency monthly_balance_transactions is a temporary table that aggregates and pivots different Note: this query may need to be modified to handle additional payout/transfer types if you are using Connect This template returns a monthly summary of your activities, including all payments in the UTC time zone
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |