1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.
-
Upload
bennett-thornton -
Category
Documents
-
view
225 -
download
1
Transcript of 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.
![Page 1: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/1.jpg)
1
16th XBRL International Conference
Demystifying XBRL FormulasDecember 5, 2007
Herm Fischer
![Page 2: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/2.jpg)
2
Overview
Why, who needs formulas for what? Historical perspectives Process flow of formulas Formula Linkbase
ContentsFormula processingFeatures by use case exampleDTS discovery
FunctionsBuilt-inEnd-user
Roadmap
![Page 3: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/3.jpg)
3
Why formulas
Calculation Linkbase is Enough
Roll-ups validates item sums Addition within equal context
◦ Period, entity, dimension are equal
Calculation Linkbase Can’t Do
Cross context◦ Movement (start + changes = end)◦ Dimensions
Business rules
![Page 4: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/4.jpg)
4
Historical Perspectives
2002 - FDIC contract motivates solutionso Conceptual prototype based on XSLo Excel-like, implicit matching (now in use)
“ - Rule base Requirements IWD 2003 - XPath syntax chosen “ - Functions spec drafted. 2004 - Formula drafts, some
implementations 2006 - Alternative approach with XQuery 2007 Jan- Issued Formula PWD Feb, Mar - Survey of users, feedback June – PWD update based on survey feedback Dec (late) – PWD-2
![Page 5: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/5.jpg)
5
Original motivationEffective exchange of data Information producer
o Validate data types and valueso Consistency and quality checks
Information consumero (ditto)o Completeness checkso Augment received data with calculated values o Augment received data with annotations
![Page 6: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/6.jpg)
6
XBRL without formulas
Calculation linkbase o Well behaved roll-ups of compatible numerical
valueso (Proposed) Aggregation of dimensional values
Calculation linkbase can’t doo Cross-context (ending bal = starting bal +
changes)o Cross-unit (dollars = price per share X nbr shares)o Dimensional aggregation (all = red wine + white
wine)o Missing items checkso Threshold and limits (sum amounts ± €5)
![Page 7: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/7.jpg)
7
Process flow of formulas
Input inst.DTS
contextsunits
fact items
Formula LB*
FormulaProcessor
Output inst.computedfact items
*Formula LB is part of DTS
![Page 8: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/8.jpg)
8
Input instance processing
Instance provides producer’s taxonomy, facts, and producer’s formulas
Consumer may have their own formulas, their own resulting items taxonomy
Formula processor ‘fires’ formulas that match to input fact items
Formula processor produces output instance with result fact items
![Page 9: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/9.jpg)
9
Formula linkbase contents
Input inst.DTS
contextsunits
fact items
FormulaProcessor
Output inst.computedfact items
Formula LB*
Parameter(select expr.)
customfunction
variable filter
loc label ref.
formulaarcprecondition
*Formula LB is part of DTS
![Page 10: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/10.jpg)
10
Formula processing
Input inst.DTS
contextsunits
fact items
Formula LB*
For each/any formula (unordered)•Evaluate parameters (if any)•Filter/bind variables in their order
•Nested variable iteration•Test precondition (if any)
•Evaluate value•Produce output fact
Output inst.computedfact items
FormulaProcessor
*Formula LB is part of DTS
![Page 11: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/11.jpg)
11
Assets sum test, pseudo codeTest that “assets = liabilities +
equity”o Input instance has assets, liabilities, and equityo Output boolean test result, true or false
![Page 12: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/12.jpg)
12
Assets sum test, flow Processing flow
Input inst.DTS
assets, liab, equity
Formula LB*
FormulaProcessor
Output inst.Test result
boolean
*Formula LB is part of DTS
![Page 13: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/13.jpg)
13
Assets sum test, instances Instance document input has values to test
Output is the boolean result of testing the sum
same contextunits match
![Page 14: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/14.jpg)
14
Assets sum test, formula linkbase
<formula value="$assets eq ($liabilities + $equity)" > <context referenceVariable=”assets” /></formula>
Tests the balance of a balance sheet.
E-L
factVariable
assets
factVariable
liabilities
factVariable
equity
Binds to any assets fact
Implicit matching to $assets fact
Implicit matching to $liabilities fact
E-L
E-L
E-L
conceptName filtername=”Assets”
label resources
conceptName filtername=”Liabilities”
conceptName filtername=”Equity”
C-F
no dependencies between these facts,so could have been in any order;implicit matching is always to preceding
non-sequence fact variable
loc
ValidAssetsCheck
![Page 15: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/15.jpg)
15
Assets sum test, formula resources
![Page 16: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/16.jpg)
16
Assets sum test, formula - compiled
![Page 17: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/17.jpg)
17
Assets sum test, formula execution
![Page 18: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/18.jpg)
18
Assets sum test, formula input
![Page 19: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/19.jpg)
19
Variation: Compute the assets Prior example tested assets = equity +
liabilities◦ 3 inputs (assets, equity, liabilities)◦ 1 output (boolean test)
Now no input sum - compute sum as the result◦ 2 inputs (equity, liabilities)◦ 1 output (monetary assets)
![Page 20: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/20.jpg)
20
Compute assets, taxonomy
Taxonomy has monetary concepts for assets, liabilities, equity
Here output is the assets concept (vs. boolean)
Last example:
![Page 21: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/21.jpg)
21
Compute assets, instances Instance document input has values to add
Output is the monetary result of adding the sum
same contextunits match
![Page 22: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/22.jpg)
22
Compute assets, formula linkbase <formula
value=”$liabilities + $equity" > <context referenceVariable=”liabilities”/> <unit referenceVariable=”liabilities”></formula>
Computes assets of a balance sheet.
factVariable
liabilities
factVariable
equity
Binds to any liabilities fact
Implicit matching to $liabilties fact
E-L
E-L
conceptName filtername=”Liabilities”
label resources
conceptName filtername=”Equity”
C-F
no dependencies between these facts,so could have been in any order;implicit matching is always to preceding
non-sequence fact variable
loc
Assets
![Page 23: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/23.jpg)
23
Formula linkbase resources
Parameter Function declaration Formula Variables Filters Precondition Generic label Generic reference
![Page 24: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/24.jpg)
24
Parameter resources Provide input parameters to formula
processor◦ From external source (invocation of processor)◦ Or from XPath expression in Parameter
May be required (or optional) Evaluated before any formula variable
(Parameter resources can have arcs to labels & references)
![Page 25: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/25.jpg)
25
Function declaration resources Declare functions usable in XPath expressions
◦ May be user-supplied◦ May be built-in to formula processor◦ May relate to formula registry
Function input parameters◦ Order, data type
Function name Function output data type
(Function declarations can have arcs to labels & references)
![Page 26: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/26.jpg)
26
Formula resource Value expression Concept (either fact variable name or arc to
loc) Context & Unit (where needed)
◦ Fact variable reference (copy from fact variable)◦ Override facets by xml (e.g., period, measure)
Arcs to variables, precondition
(Formula resources can have arcs to labels & references)
![Page 27: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/27.jpg)
27
Variable resources Fact variables
◦ Bind to input instance fact items/tuples◦ Arcs to filters constrain which input facts to bind to◦ Iterates through filtered input facts or returns
sequence General variables
◦ An XPath expression (not to input fact nodes)◦ Produce sequence or individual atomic results◦ No arcs to filters
Order in formula by dependency of variables & filters
(Variables may have arcs to labels & references)
![Page 28: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/28.jpg)
28
Filter resources Specify a facet to use as fact predicate
◦ Have arc(s) from fact variable(s) Available filter facets
◦ Concept, Dimension, Entity, Period, Tuple, Unit, Value, and General (XPath expression)
Implicit filtering◦ Automates matching non-explicitly filtered facets
Variable-set ◦ PWD 2 feature facilitating filter grouping
(Filters can have arcs to labels & references)
![Page 29: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/29.jpg)
29
Precondition resource Provides an XPath expression to test Runs after parameters and variables are
bound Arc-connected from formula resource(s) PWD 2 adds variable-set precondition
feature
(Preconditions can have arcs to labels & references)
![Page 30: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/30.jpg)
30
Generic label resources Annotates descriptive text on any
◦ Resource (e.g., any in formula LB)◦ Element in xsd (e.g., concept, arc type, etc.)
Arc connected (from resource or element) Unconstrained contents
![Page 31: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/31.jpg)
31
Generic reference resources Provides link:part’s to any
◦ Resource (e.g., any in formula LB)◦ Element in xsd (e.g., concept, arc type, etc.)
Arc connected (from resource or element)
![Page 32: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/32.jpg)
32
Fact variable filters
Concept filter Dimension filter Entity filter General filter Period filter Tuple filter Unit filter Value filter PWD-2 additions: Boolean, Match, Relative
![Page 33: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/33.jpg)
33
Concept filter
Filter by name of concept Filter by facet of concept
◦ Balance ◦ Data type◦ Substitution group◦ Period type◦ Custom attribute
![Page 34: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/34.jpg)
34
Concept name filter Sum test uses a concept filter
on each variable
<cf:conceptName xlink:type="resource" xlink:label="filter_assets“> <cf:name strict=“true”>
<cf:qname>eg:assets</cf:qname> </cf:name>
</cf:conceptName>
Formula
factVariable
assets
factVariable
liabilities
factVariable
equity
conceptName filtername=”Assets”
conceptName filtername=”Liabilities”
conceptName filtername=”Equity”
![Page 35: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/35.jpg)
35
Period filter Match completely another variable’s
period Match date date/time of:
◦ periodStart◦ periodEnd◦ periodInstant◦ periodInstantDuration
Matching by an XPath 2 expression
![Page 36: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/36.jpg)
36
PeriodStart filterMovement example
Ending balance = beginning balance + changes
Inputs have cross-context matchingo Starting balance’s date matches duration’s starto Ending balance’s date comes from duration’s end
![Page 37: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/37.jpg)
37
Use case, movement example
$changes periodStart filter depends on
$beginningBalance, which determines order
<formula value="$beginningBalance + $changes" concept=”beginningBalance” > <context referenceVariable="beginningBalance”> <period><instant value=”xfi:per’end($changes)”></period> </context> <unit referenceVariable=”beginningBalance”/> <decimal>xfi:decimals($beginningBalance),</decimal></formula>
Computes ending balance from beginningBalance plus changes
E-L
factVariable
beginningBalance
factVariable
changes
Binds to any beginningBalance
Binds to any changes with a duration matching the $beginningBalance instant
E-L
E-LconceptName filtername=’Balance’
periodStart filterdate=’xfi:period-instant( xfi:period($beginningBalance))’
conceptName filtername=’Changes’
![Page 38: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/38.jpg)
38
Period filter PeriodStart filter matches
change’s duration start dateto beginningBalance’s instant date
<pf:periodStart date=“xfi:period-instant(xfi:period($beginningBalance))” />
Formula
factVariable
beginningBalance
factVariable
changes
F-V
F-V
V-F
V-F V-FconceptName filter
name=’Balance’
periodStart filterdate=’xfi:period-instant( xfi:period($beginningBalance))’
conceptName filtername=’Changes’
![Page 39: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/39.jpg)
39
Aspects Location (tuple nesting) (both tuple & item) Concept (namespace & name) ( “ ) Entity identifier (item only) Period ( “ ) Segment (complete, nonXDT, or dimension)
( “ ) Scenario ( “ ) ( “ ) Unit (numeric items only)
![Page 40: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/40.jpg)
40
Implicit filter, beginning balance
Context
Entity
- Identifier All
- Segment All
Period All
Scenario All
Unit Name
Measure All
Concept All
Default Implicit Search Criteria
+
Explicit Criteria from Variable Definition
Context
Entity
- Identifier
- Segment
Period
Scenario
Unit Name
Measure
Concept ‘Balance’
=
Search Criteria for Variable
Context
Entity
- Identifier All
- Segment All
Period All
Scenario All
Unit Name
Measure All
Concept ‘Balance’
Carried forward Implicit Search
Criteria
Context
Entity
- Identifier 01
- Segment None
Period I-2007
Scenario None
Unit Name
Measure USD
Concept All
Location All Location Location All Location Not tuple
![Page 41: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/41.jpg)
41
Implicit filter, changes
Context
Entity
- Identifier 01
- Segment None
Period I-2007
Scenario None
Unit Name
Measure USD
Concept All
Beginning Balance Implicit
Search Criteria
+
Explicit Criteria from Variable Definition
Context
Entity
- Identifier
- Segment
Period Inst match duration start
Scenario
Unit Name
Measure
Concept ‘Changes’
=
Search Criteria for Variable
Context
Entity
- Identifier 01
- Segment None
Period D-2008
Scenario None
Unit Name
Measure USD
Concept ‘Changes’
Carried forward Implicit Search
Criteria
Context
Entity
- Identifier 01
- Segment None
Period D-2008
Scenario None
Unit Name
Measure USD
Concept All
Location Not tuple Location Location not tuple Location Not tuple
![Page 42: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/42.jpg)
42
Implicit scenario & segment issues
Dimensional implicit filters◦ Dimension contents are matched with d-equals◦ Remaining contents matched with s-equals
Non-dimensional implicit filters◦ Contents matched with s-equals
![Page 43: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/43.jpg)
43
Result concept taken from input fact
<formula value="$beginningBalance + $changes" concept=”beginningBalance” > <context referenceVariable="beginningBalance”> <period><instant value=”xfi:per’end($changes)”></period> </context> <unit referenceVariable=”beginningBalance”/> <decimal>xfi:decimals($beginningBalance),</decimal></formula>
factVariable
beginningBalance
factVariable
changes
F-V
F-V
V-F
V-F
conceptName filtername=’Balance’
conceptName filtername=’Changes’
Result concepttakes conceptof a boundvariable insteadof loc & arc
![Page 44: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/44.jpg)
44
Movement example Try it, examine it, execute it online:
◦ Directory …\xml\examples\0004 Movement
![Page 45: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/45.jpg)
45
Use case, stock flow Ending stock = starting stock + inflow – outflow
◦ Starting context (instant at start date)◦ Flow/change context (duration from start to end)◦ Ending context (instant at end date)
Inputs have cross-context period matching◦ Starting stock’s instant date matches inflow & outflow
duration starts◦ Both inflow & outflow need periodStart matching
Output result (ending stock) gets inflow/outflow duration ending date◦ Formula specifies period for ending stock
![Page 46: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/46.jpg)
46
Use case, stock flow
$inflow & $outflow periodStart filters depend on $start, which determines they follow start, but no inter-
dependencies between $inflow & $outflow themselves
<formula value="$start + $inflow - $outflow" concept=”start” > <context referenceVariable="start” > <period><instant value=”xfi:per’end($changes)”></period> </context> <unit referenceVariable=”start”/> <decimal>xfi:decimals($start),</decimal></formula>
Computes end stock from start stock plus inflows less outflows.
E-L
factVariable
start
factVariable
inflow
factVariable
outflow
Binds to any start stock
Binds to any inflow with a duration matching the start stock instant
Binds to outflow matching start as above and implicitly matching same period duration as the inflow
E-L
E-LconceptName filtername=’Stock’
periodStart filterdate=’xfi:period-instant( xfi:period($start))’
conceptName filtername=’Outflow’
conceptName filtername=’Inflow’
result’s periodis duration end
periodstart
filtering
![Page 47: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/47.jpg)
47
Stock Flow example Try it, examine it, execute it online:
◦ Directory …\xml\examples\0003 Stock Flow
![Page 48: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/48.jpg)
48
Tuple filter ParentTuple
◦ Concept name of the fact’s tuple parent AncestorTuple
◦ Concept name of a fact’s ancestor TupleSibling
◦ Another variable’s fact is a sibling of this fact TupleLocation
◦ Another variable’s fact is a given relation to this fact
◦ E.g., $a is “../eg:tupleB/*” related to this fact
![Page 49: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/49.jpg)
49
GL-based tuple examples (tuples in, non-tuples out)
Trial balance in-balance checks◦ For each entry details section check if in-balance◦ Output string result item (for this example)
Trial balance ending balances report◦ For each account add changes to balance brought
fwd◦ Aggregate account across entry detail sections◦ Output string result item (acct name & ending
balance) (Research into tuple generation is discussed later)
![Page 50: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/50.jpg)
50
GL trial balance check<xbrli:xbrl>
<gl-cor:accountingEntries><gl-cor:entryHeader>
<gl-cor:qualifierEntry …>balance-brought-forward</ …>
<gl-cor:entryDetail><gl-cor:amount …>242678.26</ …><gl-cor:debitCreditCode …">D</ …>
</gl-cor:entryDetail>…
</ gl-cor:entryHeader><gl-cor:entryHeader>
<gl-cor:qualifierEntry …>standard</ …><gl-cor:entryDetail>
<gl-cor:amount …>242678.26</ …><gl-cor:debitCreditCode …">D</ …>
</gl-cor:entryDetail>…
</ gl-cor:entryHeader></ gl-cor:accountingEntries>
</ xbrli:xbrl>
accountbalances
period’schanges
D – debitC - credit
Check if sections are in balance:sum(amts with ‘D’ siblings) =
sum(amts with ‘C’ siblings)
![Page 51: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/51.jpg)
51
General filter
Just an XPath 2 expression◦ Need to test if sibling of amount is credit code
<gl-cor:entryDetail>
<gl-cor:amount …>242678.26</ …><gl-cor:debitCreditCode …">D</ …>
</gl-cor:entryDetail>
◦ test=“../gl-cor:debitCreditCode eq ‘D’”
![Page 52: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/52.jpg)
52
Trial balance checks<formula value="if ( abs( sum($creditAmts) - sum($debitAmts) ) lt 1.0 )
then concat( $qalifier, ‘ is in balance‘) else concat( $qalifier, ‘ is not in balance‘)" > <context referenceVariable=”qualifier” /></formula>
Tests the balance of a qualifier’s section of GL entry details.
E-L
factVariable
qualifier
factVariable
creditAmts
factVariable
debitAmts
F-VF
-V bin dA
s Se q=
”tr ue”
F-V bindA
sSeq=”true”
V-F
V-F
V-F
Binds to any qualifierEntry fact, e.g., BBF or standard
Sequence of qualifier’s “C”-sibling amts
Sequence of qualifier’s “D”-sibling amts
E-L
E-L
E-L
conceptName filtername=”qualifierEntry”
label resources
conceptName filtername=”amount”
tupleLocation filterfact=”qualifier”location=”../../*”
C-F
each of creditAmts and debitAmts depends on qualifier, but credit & debit
could be in any order to each other
tupleParentName=”entryHeader”
V-F
V-F
V-F
general filtertest=”../debitCreditCode eq ‘D’”
general filtertest=”../debitCreditCode eq ‘C’”
V-F
loc
EntriesInBalance
![Page 53: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/53.jpg)
53
Value filter
Value matches an XPath 2 expression Not Nil test Nil test Precision expression
![Page 54: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/54.jpg)
54
GL ending balance computation<xbrli:xbrl>
<gl-cor:accountingEntries><gl-cor:entryHeader>
<gl-cor:qualifierEntry …>balance-brought-forward</ …><gl-cor:entryDetail>
<gl-cor:account><gl-cor:accountMainID …>5100</ …><gl-cor:accountMainDescription …>Supplies</ …><gl-cor:accountType …>account</ …>
</gl-cor:account><gl-cor:amount …>242678.26</ …><gl-cor:debitCreditCode …">D</ …><gl-cor:xbrlInfo>
<gl-cor:xbrlInclude …>beginning_balance</…></gl-cor:xbrlInfo>
</gl-cor:entryDetail>…
</ gl-cor:entryHeader><gl-cor:entryHeader>
<gl-cor:qualifierEntry …>standard</ …><gl-cor:entryDetail>
…</gl-cor:entryDetail>…
</ gl-cor:entryHeader></ gl-cor:accountingEntries>
</ xbrli:xbrl>
aggregate byaccount
skip ending_balances
![Page 55: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/55.jpg)
55
GL ending balance computation<formula
value="concat( ‘Account ‘, $acctID, ‘ ending balance is ‘,(sum($creditAmts) - sum($debitAmts) ) )" >
<context referenceVariable=”qualifierBBF” /></formula>
Tests the balance of a qualifier’s section of GL entry details.
factVariable
acctID
factVariable
creditAmts
factVariable
debitAmts
F-V b indA sSeq=”tru e”
Binds to the qualifierEntry for BBF entryHeader beginning balance
Sequence of qualifier’s “C”-amts for this acct
Sequence of qualifier’s “D” amts for this acct
E-L
conceptName filtername=”accountMainID”
label resources
conceptName filtername=”amount”
first qualifierBBF fact, then for each acctID in entryHeader with BBF, then
seqence of C and D amts for that acctID
general filtertest=”../debitCreditCode eq ‘D’
and ../account/accountMainID eq $acctID”
general filtertest=”../debitCreditCode eq ‘C’
and ../account/accountMainID eq $acctID”
factVariable
qualifierBBF
conceptName filtername=”qualifierEntry”
parentTuple filterName=”entryHeader”
value filtertest=”balance-brought-forward”
tupleLocation filterfact=”qualifierBBF”
location=”../../../qualifierEntry”
Binds to each acctID in the BBF entryHeader
E-L
loc
EndingBalance
tupleLocation filterfact=”acctID”
location=”../acct/acctMainID”
general filtertest="../../gl-cor:xbrlInfo/gl-cor:xbrlInclude
ne 'ending_balance'"
general filtertest="../../gl-cor:xbrlInfo/gl-cor:xbrlInclude
ne 'ending_balance'"
![Page 56: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/56.jpg)
56
GL ending balance test Added 2 more variables
◦ For each account Get amount for ending-balance entry with ‘C’ (credit)
code Get amount for ending-balance entry with ‘D’ (debit)
code◦ Change equation to test
Sum (credits which are not ending-balance - debits which are not ending-balance +
credit which is ending-balance – debit which is not ending-balance) < 1.00
![Page 57: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/57.jpg)
57
GL example code
Try it, examine it, execute it online:◦ Directory …examples\0007 GL Examples
Instance-trial-balance-check.xml Instance-test-ending-balance.xml Instance-compute-ending-balance.xml
![Page 58: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/58.jpg)
58
Dimension filter Explicit Dimension filter
◦ Fact has QNamed dimension (in context or default)
◦ Constrained if arcs to allowed member concepts Dimension Member filter
◦ Constrains to member’s children or its descendants
Typed Dimension filter◦ Typed dimension is specified by QName◦ XPath 2 expression tests dimension value
![Page 59: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/59.jpg)
59
Dimension filter, implicit interactions
Primary items with multiple dimensions◦ Dimensions explicity filtered◦ Remaining dimensions implict matched◦ Remainder of segment/scenario implicit matched
Example has 2 dimensions (product, region)◦ Aggregation check by product or region requires
implicit matching of other dimension
![Page 60: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/60.jpg)
60
Dimension aggregation Test aggregation of
each member Products & region
dimensions have member hierarchy
![Page 61: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/61.jpg)
61
Pharmaceutical example
Multiple periods for used dimensions
Multiple dimensions per contexts
(Charlie’s aggregation example)
![Page 62: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/62.jpg)
62
Two dimensions to check Will require checking of aggregation for
◦ Product dimension◦ Region dimension
Formula shown for product dimension(region is same except for dimension name)
Demonstrates mixed explicit/implicit dimension filtering
![Page 63: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/63.jpg)
63
Product dimension check<formula value="abs( $sales - sum($salesBreakdown) ) lt 1.00"> <context referenceVariable=”sales” /></formula>
Tests aggregate of sales is within €1.00 of contributor sales items
E-L
factVariable
sales
factVariable
salesBreakdownF-V F
-V bindA
sSeq=
”true”
V-F
V-F
Binds to any sales fact
Sequence of contributors which are dimensional children of product, implicit matching of period etc to sales
E-L
E-L
conceptName filtername=”Sales”
label resources
dimensionMember filterdimension=”company:ByProductPlaceholder”
member=”xfi:dimension-value($sales,QName(“company:ByProductPlaceholder”))
C-F
The breakdown is dependent on the dimension of the sales variable, so that
determines the order
V-F
loc
ValidByProduct
preconditiontest=”count($salesBreakdown) gt 0”
F-P
![Page 64: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/64.jpg)
64
Product dimension check
Try it, examine it, execute it online:◦ Directory …examples\0005 Pharmaceutical
![Page 65: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/65.jpg)
65
COREP Use case 18: Weighted average of member children Weighted average of its dimensional children
by another primary item
ii
iii
dp
dpdpdp
)(
)()()(
.12
.12.11
11
Primary items ==>PD Assigned to the obligor grade Exposure value
Capital requirements
Total Exposures (dimension) 60% 26.750,00 € 1 Assigned to obligor grade 27% 1.250,00 € Obligor grade 1 10% 100,00 € Obligor grade 2 20% 150,00 € Obligor grade 3 30% 1.000,00 € 2 Specialized lending slotting 62% 25.500,00 € Risk weight 0% 50% 500,00 € Risk weight 10% 75% 20.000,00 € Risk weight 150% 10% 5.000,00 €
![Page 66: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/66.jpg)
66
Weighted average of member children Excel formulas:
Make PD controlling fact, get PD and EV of dimensional children
General variable for PDxEV member matching
Primary items ==>PD Assigned to the obligor grade Exposure value Capital requirements
Total Exposures (dimension) =(B3*C3+B7*C7)/C2 =C3+C7 1 Assigned to obligor grade =(B4*C4+B5*C5+B6*C6)/C3 =SUMA(C4:C6) Obligor grade 1 0,1 100 Obligor grade 2 0,2 150 Obligor grade 3 0,3 1000 2 Specialized lending slotting =(B8*C8+B9*C9+B10*C10)/C7 =SUMA(C8:C10) Risk weight 0% 0,5 500 Risk weight 10% 0,75 20000 Risk weight 150% 0,1 5000
![Page 67: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/67.jpg)
67
Weighted average of member children <formula
value="abs($PD – (sum($PDxEV) div sum(EVkids) ) ) lt 0.005"> <context referenceVariable=”PD” /></formula>
Tests PD of input instance is within ½% of weighted average value
E-L
factVariable
PD
factVariable
PDkids
Binds to any PD fact
Sequence of PD values for dimensional children of $PD
E-L
E-L
conceptName filtername=”PD”
label resources
dimensionMember filterdimension=”t:TotalExposures”
member=”xfi:dimension-value($PD,QName(‘ExposuresDimension’))”
C-F
Pdkids & Evkids depend on PD, PDxEV
on both Pdkids & EVkids
factVariable
EVkids
conceptName filtername=”EV”
Sequence of PD values for dimensional children of $PD
E-L
preconditiontest=”count($PDkids) eq count($EVkids)
and sum($EVkids) gt 0"
general variable PDxEVfor $pd in $PDkids, $ev in $EVkids[xfi:dimension-value(.,QName(‘ExposuresDimension’) = xfi:dimension-value($pd,QName(‘ExposuresDimension’)] return $pd * $ev
Sequence of ev x pd for matching dimensions
loc
ValidPD
![Page 68: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/68.jpg)
68
Weighted average of member children Try it, examine it, execute it online:
◦ Directory …\xml\examples\0006 Weighted Avg
![Page 69: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/69.jpg)
69
PWD 2 Filter Additions Boolean filter
◦ Allows grouping and/or filter expressions Match filter
◦ Specifies specific aspects to match Relative filter
◦ Specify matching all non-covered aspects
![Page 70: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/70.jpg)
70
PWD 2 Assertion additions Assertions are alternate to formula item
production Fact Consistency assertion
◦ Produced fact matches corresponding fact(s), in value
Existence assertion◦ Filtering constructs find existing fact item
Value assertion◦ Value-assertion expression is true
![Page 71: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/71.jpg)
71
Functions Built-in functions
◦ Functions 1.0 December 7, 2006 http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm
User-defined functions◦ Signatures provided in linkbase resources◦ Code provided to formula processor somehow
Maybe XQuery Maybe Java or other coding language
![Page 72: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/72.jpg)
72
Functions 1.0 examples Precision
◦ xfi:precision( item )◦ xfi:decimals( item )
Accessors◦ xfi:context( item )◦ xfi:unit( item )◦ xfi:period( context )◦ xfi:period-start, :period-end, :period-
instant( period )
![Page 73: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/73.jpg)
73
Roadmap Comments to re-issued PWD Implement formula processors Implement formula editors Discuss additional desired features
◦ Formula chaining◦ Tuple output production◦ Multiple-input instances, DTSes◦ other
![Page 74: 1 16 th XBRL International Conference Demystifying XBRL Formulas December 5, 2007 Herm Fischer.](https://reader035.fdocuments.net/reader035/viewer/2022062321/56649efd5503460f94c10876/html5/thumbnails/74.jpg)
74
Herm [email protected]
[email protected]+1-818-995-7671 +1-818-404-4708
http://herm.ws/XBRL/files/docs/FormulaTutorial.ppt
THANK YOU! Let us help you get your first formulas easily!
Questions