My apologies, I didn't notice when I replied that this was in the SSRS forum. I've got a solution but it just generates the data so I don't know if it'll be useful for you or not, I've included the query below:select location
, TobaccoUseInLast30Days
, count(PatientNumber)
from #Test
group by Location, TobaccoUseInLast30Days
order by Location;