。
My calculations went wrong somewhere.
Literal
I [of-の] calculation [subject-が] somewhere [in-で] ended-up-wrong.
間違える ('to make a mistake') is the transitive verb — here in the ~てしまう completion form, marking that the mistake has happened (regrettably). どこかで uses で for the location of the error — 'somewhere in the process.' The が on 計算 marks it as the grammatical subject that went wrong.