It depends on your university's marking schedule/guidelines. You should be able to find this document somewhere on their website, or just google the name of your university and marking schedule/guidelines.
It is possible at my university. I got high As (90-95%) in all but one of my taught components, and a high B in one other. Annoyingly I got a high B for my dissertation, but still got a distinction. The boundary for distinction was an overall GPA 17.5 out of 22 on my uni's grade scale, and I got 18.7. We also needed a minimum of a 17 (high B) on the dissertation, which I got, and more than half of our taught components a high B. So although I got the minimum dissertation grade required I still got what was considered a fairly high distinction, and potentially the highest grade of the cohort (been told this but waiting for confirmation).
But definitely check what the rules are for your university, or ask your convenor/advisor/administrator if you can't find this.