with base as (select
count(distinct(asset_id)) as fifa_nft_holding
from algorand.nft.ez_nft_metadata_fifa a
join algorand.core.fact_account_asset b
on a.nft_asset_id = b.asset_id
where amount > 0
and address ilike '{{ALGO_Wallet}}'),
base2 as (select
address,
count(distinct(asset_id)) as fifa_nft_holding
from algorand.nft.ez_nft_metadata_fifa a
join algorand.core.fact_account_asset b
on a.nft_asset_id = b.asset_id
where amount > 0
group by 1)
select fifa_nft_holding,
(select avg(fifa_nft_holding) from base2) as global_holding,
fifa_nft_holding - global_holding as deviation_avg
from base