They are accounted for using a “net” position.
Example: Imagine that DB has sold a credit default swap to party A, but then also bought a credit default swap from party B on the same underlying position. Let’s say each CDS derivative was for $1 billion. One is a bet that some entity won’t default, the other is a bet that they will. So they actually counter each other and once you net them out the maximum possible loss or gain for DB can be calculated.
Suppose in our example that the net exposure is a maximum of +/- $10 million. That’s what DB would have to post capital against, not the $2 billion (which is the notional amount). The $47 trillion number is a notional amount. We can’t really know what DB’s net exposure is, except for what management tells us it is in their annual report. I would bet that they don’t actually know either. It’s just too complicated (because of how contracts interact with each other).
This all makes some sense, but the main concern is this; what’s DB’s actual exposure if party B goes belly up and cannot pay? Then what? Well, then DB is on the hook for whatever it owes party A but it’s getting nothing from party B except a long and probably fruitless court battle.
It’s not at all unthinkable that if/when the derivatives mess unwinds (explodes?) that counterparty exposure leads to a critical mass of failures to pay which will blow a huge gaping hole in the carefully crafted risk strategies of virtually every large bank in the world.