You can use analytical function as follows:
select distinct country, city,
count(distinct username) over (partition by country, city) as distinct_users_per_city,
count(distinct username) over (partition by country) as distinct_users_per_country
from your_Table t
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…