Average settlement amount per transaction

SQL query for Klarna

Calculate the average settlement amount for each transaction in the settlement_transactions table.

SELECT transaction_id, AVG(settlement_amount) AS average_settlement_amount FROM settlement_transactions GROUP BY transaction_id

Klarna data model

Table Settlement Payouts
Merchant_id: String
Payout_date: String
Transactions: String
Currency_code: String
Payment_reference: String
Totals_fee_amount: Integer
Totals_tax_amount: Integer
Totals_sale_amount: Integer
Totals_repay_amount: Integer
Totals_charge_amount: Integer
Totals_credit_amount: Integer
Totals_return_amount: Integer
Totals_release_amount: Integer
Totals_holdback_amount: Integer
Totals_reversal_amount: Integer
Merchant_settlement_type: String
Totals_commission_amount: Integer
Totals_settlement_amount: Integer
Totals_fee_correction_amount: Integer

Table Settlement Transactions
Type: String
Amount: Integer
Payout: String
Order_id: String
Refund_id: String
Sale_date: String
Capture_id: String
Vat_amount: Integer
Merchant_id: String
Capture_date: String
Currency_code: String
Detailed_type: String
Short_order_id: String
Purchase_country: String
Payment_reference: String
Merchant_reference1: String
Merchant_reference2: String
Consumer_vat_0_tax_rate: Integer
Consumer_vat_1_tax_rate: Integer
Shipping_address_country: String
Consumer_vat_0_tax_amount: Number
Consumer_vat_1_tax_amount: Number
Initial_payment_method_type: String
Initial_payment_method_monthly_downpayments: Integer

Use SQL on all your SaaS data

Magical SQL for Klarna with Peliqan.io

Explore data in a rich spreadsheet UI. Use Magical SQL to combine and transform data. SQL queries become new tables that can be shared with business users and used in any BI tool such as Microsoft Power BI, Tableau or Metabase.

Let AI do the work for you

Peliqan’s AI assistant helps you to write SQL queries to get to insights fast. Ask your question in plain English and immediately see the result in Peliqan’s rich spreadsheet viewer.

Peliqan Ask AI willl write your SQL queries from plain English