An easy fix is simply to divide each line by the sum, like this (ugly, but it works):
ISNULL(Alternatives, 0) / (ISNULL(Alternatives, 0) + ISNULL([Community-Based Process], 0) + ISNULL(Education, 0) + ISNULL(Environmental, 0) + ISNULL([Information Dissemination], 0) + ISNULL([Problem Identification and Referral], 0)) as AlternativesPercent
You can also calculate that sum in subquery with the use of WHERE
and GROUP BY
-- same idea, just a little cleaner.
More importantly, you should consider whether you really want to consolidate the data like this. In the image you provided, what happens when someone asks "Let me see the 5 Environmental's in Bedford" -- you need to run another query. If you go a step further and provide percentages instead of nominal numbers, you'll get even more questions like "what is bigger, 20% of Allegheny or 60% of Blair?". Tools like Excel, or any business intelligence program, can easily work with the raw data and very easily create the same pivot table you're struggling to make here. Additional things like formatting a percentage to exactly 1 decimal in Excel is MUCH easier than doing so in SQL Server. Excel and other tools support drill-through... you could click on the 5 Environmental's in Bedford and they will immediately show up as a list. Thus you get the best of both worlds -- the consolidated pivot table and the raw data. A SQL only requires additional queries to get the underlying data rows.
Consider all your options.