Provide the tax total in the tax currency at most once

Error FX-SCH-A-000192 Factur-X

Element variant 'ram:TaxTotalAmount[@currencyID=../../ram:TaxCurrencyCode]' may occur at maximum 1 times.

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

ram:SpecifiedTradeSettlementHeaderMonetarySummation contains more than one ram:TaxTotalAmount whose currencyID matches the value of ram:TaxCurrencyCode.

What the rule means

The tax total in the tax currency may occur at most once in the totals. This keeps the total tax amount for that currency unambiguous.

Please provide the tax total in the tax currency at most once

The tax total with the currency code from ram:TaxCurrencyCode appears more than once in the totals. A single entry makes this amount unambiguous.

What to do
  1. Compare the currencyID values of the ram:TaxTotalAmount elements with ram:TaxCurrencyCode.
  2. Make sure no more than one ram:TaxTotalAmount uses that currency code.
  3. Regenerate the invoice and validate it again.
What it looks like
✗ Triggers the message
<ram:ApplicableHeaderTradeSettlement>
  <ram:TaxCurrencyCode>EUR</ram:TaxCurrencyCode>
  <ram:SpecifiedTradeSettlementHeaderMonetarySummation>
    <ram:TaxTotalAmount currencyID="EUR">1</ram:TaxTotalAmount>
    <ram:TaxTotalAmount currencyID="EUR">1</ram:TaxTotalAmount>
  </ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
✓ Correct
<ram:ApplicableHeaderTradeSettlement>
  <ram:TaxCurrencyCode>EUR</ram:TaxCurrencyCode>
  <ram:SpecifiedTradeSettlementHeaderMonetarySummation>
    <ram:TaxTotalAmount currencyID="EUR">1</ram:TaxTotalAmount>
  </ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
Technical details

The test counts only ram:TaxTotalAmount elements whose currencyID matches ram:TaxCurrencyCode and allows no more than one.

Where the rule applies

In the totals, this concerns ram:TaxTotalAmount whose currencyID matches ram:TaxCurrencyCode.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedTradeSettlementHeaderMonetarySummation
Test expression (assert/@test)
count(ram:TaxTotalAmount[@currencyID=../../ram:TaxCurrencyCode])<=1