# BR-DEX-02 Line net amount should equal the sum of its sub invoice lines

The Invoice line net amount (BT-131) of an INVOICE LINE (BG-25) or a SUB INVOICE LINE (BG-DEX-01) should equal the sum of the Invoice line net amounts (BT-131) of the SUB INVOICE LINEs (BG-DEX-01) directly beneath it.

## Problem Description

> **WARNING**: XRechnung extension rule (KoSIT, BR-DEX) · XRechnung 3.0

## Context and Significance

This XRechnung Extension rule only applies in the Extension scenario, which allows nested sub invoice lines mapped to UBL cac:SubInvoiceLine; the Schematron flags it as a warning-level arithmetic check.

## Solution

Recompute the parent BT-131 so it equals the total of the child SubInvoiceLine BT-131 values, or correct the sub-line amounts. If sub invoice lines are not required, the standard XRechnung CIUS profile avoids this Extension rule.

- [Validate XML](/en/xrechnung-validator?source=resource&rule=BR-DEX-02)
- [Convert invoice](/en/pdf-to-xrechnung?source=resource&rule=BR-DEX-02)

## Valid Examples

- Parent BT-131 = 100.00; two sub lines with BT-131 = 60.00 and 40.00

## Invalid Examples

- Parent BT-131 = 100.00; sub lines sum to 90.00

## Code Examples

### Valid XML
```
<cac:InvoiceLine>
  <cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
  <cac:SubInvoiceLine>
    <cbc:LineExtensionAmount currencyID="EUR">60.00</cbc:LineExtensionAmount>
  </cac:SubInvoiceLine>
  <cac:SubInvoiceLine>
    <cbc:LineExtensionAmount currencyID="EUR">40.00</cbc:LineExtensionAmount>
  </cac:SubInvoiceLine>
</cac:InvoiceLine>
```

### Invalid XML
```
<cac:InvoiceLine>
  <cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
  <cac:SubInvoiceLine>
    <cbc:LineExtensionAmount currencyID="EUR">60.00</cbc:LineExtensionAmount>
  </cac:SubInvoiceLine>
  <cac:SubInvoiceLine>
    <cbc:LineExtensionAmount currencyID="EUR">30.00</cbc:LineExtensionAmount>
  </cac:SubInvoiceLine>
</cac:InvoiceLine>
```

## Affected Fields

- [BT-131 Invoice line net amount](/resources/xrechnung/bt-131-invoice-line-net-amount)
- [BG-DEX-01 Sub invoice line](/resources/xrechnung)

## Related Rules

- [BR-DEX-03](/resources/kosit-validator-errors/br-dex-03-sub-invoice-line-vat-information)
- [BR-DE-21](/resources/kosit-validator-errors/br-de-21-specification-identifier-syntax)

## Validation Tools

- [Official KoSIT Validator](https://github.com/itplr-kosit/validator): Run the official KoSIT validator with the XRechnung configuration to check EN 16931 and XRechnung rules.
- [Convert PDF to XRechnung](/pdf-to-xrechnung): Find validation errors during conversion and review each correction.

## Related Resources

- [Official Specification](https://xeinkauf.de/xrechnung/)
- [Test Suite](https://github.com/itplr-kosit/xrechnung-testsuite)
- [All validation errors](/resources/kosit-validator-errors): Overview of the EN 16931, XRechnung and Peppol validation rules explained here.
