Few individuals in the eXtensible Business Reporting Language (XBRL) community would disagree that calculations are one
of the more confusing and frustrating aspects of the specification. In theory, calculations should be fairly straightforward.
All the numbers on the financial statements should add up to the stated totals, but as we know the devil is in the details.
Hopefully we can shed some light on those details by reviewing not only the basics of creating calculations, but also certain
scenarios that are either tricky or downright impossible given the current limitations of the specification.
We'll start with the basics of how XBRL calculations work. Let's say we have the following on our balance sheet:
In our calculation linkbase, the XML tags for this calculation would look something like this:
Note that "xlink:to" denotes the operand whereas "xlink:from" denotes the total. The other important item to look at is the "weight"
value. While the XBRL specification allows any numeric here, the U.S. Securities and Exchange Commission (SEC) only allows values of
either  or [-1]. Weight determines whether we are adding or subtracting the operand. Hence, the above XBRL is expressed in a
human-readable format by the following equation:
Liabilities + StockholdersEquity = LiabilitiesAndStockholdersEquity