Afonso_DiazDifference
    Updated 2024-10-10
    with

    current_tbl as (
    select
    tx_id,
    block_timestamp,
    authorizers[0] as user,
    event_data:amount as tx_fee
    from flow.core.fact_transactions
    join flow.core.fact_events
    using (tx_id)
    where tx_succeeded = 1
    and event_contract = 'A.f919ee77447b7497.FlowFees'
    and event_Type = 'FeesDeducted'
    and block_timestamp::date between case '{{ type }}'
    when 'daily' then date('{{ end_date }}') - interval '1 day'
    when 'weekly' then date('{{ end_date }}') - interval '1 week'
    when 'monthly' then date('{{ end_date }}') - interval '1 month'
    when 'yearly' then date('{{ end_date }}') - interval '1 year'
    end and '{{ end_date }}'
    ),

    before_tbl as (
    select
    tx_id,
    block_timestamp,
    authorizers[0] as user,
    event_data:amount as tx_fee
    from flow.core.fact_transactions
    join flow.core.fact_events
    using (tx_id)
    where tx_succeeded = 1
    and event_contract = 'A.f919ee77447b7497.FlowFees'
    and event_Type = 'FeesDeducted'
    and block_timestamp::date between case '{{ type }}'
    when 'daily' then date('{{ end_date }}') - interval '2 day'
    QueryRunArchived: QueryRun has been archived