I'm trying to get the percentage for all sites... I tried UCSF_P but it's wrong
SELECT A.Year
,A.Month
,(sum(A.BCHO) * 100 / NULLIF((sum(B.BCHO)), 0)) AS BCHO
,
--SELECT FORMAT((37.0/38.0),'P3') as [ThreeDecimalsPercentage]
FORMAT((sum(A.UCSF)) * 100 / (sum(B.UCSF)), 'P2') AS UCSF_P
,-------------------This is wrong
(sum(A.UCSF) * 100 / (sum(B.UCSF))) AS UCSF
,(sum(A.UCLA) * 100 / (sum(B.UCLA))) AS UCLA
,(sum(A.UCD) * 100 / (sum(B.UCD))) AS UCD
,(sum(A.UCI) * 100 / (sum(B.UCI))) AS UCI
,(sum(A.UCSD) * 100 / (sum(B.UCSD))) AS UCSD
FROM Denials_Scrub_Final_V A
INNER JOIN Claims_Final_V B ON B.Year = A.Year
AND A.Month = B.Month
GROUP BY A.Year
,A.Month
,A.UCSF
,B.UCSF
ORDER BY A.Year
,A.Month