---
id: change/bcapps/11026
type: change
title: "#11026 Service Line CalcVATAmountLines: count VAT Difference once and clear filters before OnAfterCalcVATAmountLines"
summary: Service Line CalcVATAmountLines now counts VAT differences correctly and clears filters before firing the OnAfterCalcVATAmountLines event, matching the behavior of Sales and Purchase lines.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - table service line
system: service
review:
  state: reviewed
  by: opus
  at: "2026-11-19T00:57:41.676Z"
  flags: []
generated:
  at: "2026-11-21T00:15:56.434Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 75309123c3c561753cc89d97020eef87ba2f5019
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/11026
    title: "microsoft/BCApps#11026: Service Line CalcVATAmountLines: count VAT Difference once and clear filters before OnAfterCalcVATAmountLines"
    date: "2026-11-18"
    commit: 75309123c3c561753cc89d97020eef87ba2f5019
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/table/5902
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/inventory-powerbi-purchase-and-sales-qty
      title: Purchase and Sales Quantity Power BI Report
      label: possibly related
      why: touches Table 5902 "Service Line"
      by: code
    - to: https://learn.microsoft.com/dynamics365/business-central/inventory-powerbi-scheduled-receipt
      title: Scheduled Receipt Power BI Report
      label: possibly related
      why: touches Table 5902 "Service Line"
      by: code
    - to: https://learn.microsoft.com/dynamics365/business-central/check-purchase-amounts
      title: Check amounts on purchase invoices and credit memos
      label: possibly related
      why: Documents amount checking on service documents, related to VAT calculation on service lines.
      by: model
number: 11026
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/11026
kind: pr
base_branch: main
major: "30"
merged_at: "2026-11-18T16:11:47Z"
author: Franco111000
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - From Fork
  - "Ownership: Manual"
  - "Team: Finance"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 6
  additions: 656
  deletions: 6
  al: 2
apps:
  - Base Application
objects_touched:
  - key: table/5902
    page: table/5902
    type: table
    id: 5902
    name: Service Line
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues:
  - 9102
work_items:
  - 659639
systems:
  - service
quote: null
joined_against:
  major: "30"
  commit: d2abc1d2ceae394331716c8183ef60e1534c2ce0
---

# #11026 Service Line CalcVATAmountLines: count VAT Difference once and clear filters before OnAfterCalcVATAmountLines

> Service Line CalcVATAmountLines now counts VAT differences correctly and clears filters before firing the OnAfterCalcVATAmountLines event, matching the behavior of Sales and Purchase lines.

[Pull request](https://github.com/microsoft/BCApps/pull/11026) · merged into `main` (BC30) on 2026-11-18 by Franco111000 (community contribution) · 6 files (+656 -6), 2 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Fixed VAT difference being counted twice in the accumulation by removing redundant term
- Added VATAmountLine.Reset() before OnAfterCalcVATAmountLines event to ensure unfiltered records
- Aligns Service Line implementation with Sales Line and Purchase Line behavior
- Applied fix to both W1 and NA table layers
- Added two regression tests covering VAT difference counting and filter clearing scenarios
- Behaviour changes for users or extensions.

## AL objects touched

- [Table 5902 "Service Line"](../../objects/table/5902.md), Base Application: modified

## Context

- Fixes: [#9102 [Bug]: Service Line CalcVATAmountLines double-counts VAT Difference and leaks filters onto OnAfterCalcVATAmountLines](https://github.com/microsoft/BCApps/issues/9102) (closed)
- Work items: AB#659639
- Labels: ADO: Sync, From Fork, Ownership: Manual, Team: Finance
- Systems: service

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Purchase and Sales Quantity Power BI Report](https://learn.microsoft.com/dynamics365/business-central/inventory-powerbi-purchase-and-sales-qty) — possibly related: touches Table 5902 "Service Line"
- [Scheduled Receipt Power BI Report](https://learn.microsoft.com/dynamics365/business-central/inventory-powerbi-scheduled-receipt) — possibly related: touches Table 5902 "Service Line"
- [Check amounts on purchase invoices and credit memos](https://learn.microsoft.com/dynamics365/business-central/check-purchase-amounts) — possibly related: Documents amount checking on service documents, related to VAT calculation on service lines. (model-linked)

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
