Duplicate calculated tax amount

Error FX-SCH-A-000338 Factur-X

Element 'ram:CalculatedAmount' 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:CalculatedAmount occurs more than once within ram:ApplicableTradeTax. This element may occur no more than once.

What the rule means

The calculated tax amount belongs to the invoice line’s tax information. Multiple amount elements of the same kind within one tax entry make it unclear which amount applies.

Please provide the calculated tax amount only once

The tax information for the invoice line contains ram:CalculatedAmount more than once. You can resolve this by having this element appear only once there.

What to do
  1. Locate the affected ram:ApplicableTradeTax on the invoice line.
  2. Check whether ram:CalculatedAmount occurs more than once there.
  3. Ensure that this element occurs there no more than once.
  4. Generate the invoice again and validate it once more.
What it looks like
✗ Triggers the message
<ram:ApplicableTradeTax>
  <ram:CalculatedAmount>10</ram:CalculatedAmount>
  <ram:CalculatedAmount>10</ram:CalculatedAmount>
</ram:ApplicableTradeTax>
✓ Correct
<ram:ApplicableTradeTax>
  <ram:CalculatedAmount>10</ram:CalculatedAmount>
</ram:ApplicableTradeTax>
Technical details

The check counts the direct ram:CalculatedAmount elements under ram:ApplicableTradeTax and permits at most one.

Where the rule applies

The rule applies to ram:CalculatedAmount within ram:ApplicableTradeTax on an invoice line.

Context (rule/@context)
/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax
Test expression (assert/@test)
count(ram:CalculatedAmount)<=1