with tbl1 as (select tx_group_id from algorand.transactions where TRY_BASE64_DECODE_STRING(tx_message:txn:apaa[0]::STRING) = 'S')
select sum(asset_amount/pow(10,6)),date(block_timestamp) from algorand.asset_transfer_transaction
where tx_group_id in (select tx_group_id from tbl1 )
and asset_id=571576867
group by 2