I am trying to calculate the percentage of the data that falls into categories. I used this query:
select
distinct(city),
count(distinct id) over (partition by city) as CountofGoogle
from
TABLE "
where
company_name = 'Google'
order by 2 desc
I then ended up with these results:
city | CountofGoogle |
---|---|
City A | 25000 |
City B | 6000 |
(obv a more extended table)
I'm at a loss as to how I create a 3rd column that will give me a % of the total? (i.e. if there was a total of 100000 then city A would be 25%. I've tried sum etc but getting errors
Thanks