web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Get the corresponding TaxItemGroup with given TaxGroup and tax percentage

(4) ShareShare
ReportReport
Posted on by 268
Hello,
 
I'm currently facing the task to identify the corresponding TaxItemGroup if have given a TaxGroup and the percentage of the tax e.G.: 19%.
 
Thanks for any hints.
 
Sebastian
Categories:
I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at
     
    would it be correct to understand that you want to find the record from TaxItemGroupHeading, based on information you have from table TaxOnItem
    If so there is a relationship between the two tables, that you can use to find the info.
     
     
  • André Arnaud de Calavon Profile Picture
    305,265 Super User 2026 Season 1 on at
    Hi Sebastian,
     
    A combination of TaxGroup and TaxItemGroup can find one or more TaxCodes.
    Multiple TaxCodes where the percentage of the tax is 19% can be linked to the TaxGroups. There is no guarantee that searching by a percent will give the correct TaxItemGroup. Only with some specific setup.
     
    Can you tell us what your business requirement is to bypass providing the Tax item group by a user?
  • Verified answer
    Basti Aurand Profile Picture
    268 on at
    @Sohaib Cheema: Not exactly, because I don't know how to select correct record from the TaxOnItem table. I just have the to variables:
     
    - TaxGroup: e.g. = "K-IN", which identifies vendor domestic
    - TaxPercentage: e.g. = "19", which is the percentage value of the tax to be calculated
     
    I was thinking about joining the three tables "TaxData", "TaxOnItem" and "TaxGroupData" in order to get the selection I need. Here is an example in SQL with data:
     
     
    Is this the right approach?
  • Basti Aurand Profile Picture
    268 on at
    @André Arnaud de Calavon: The requirement results from an invoice receipt interface in which, ideally, no user should be involved. Invoices are analyzed externally and the data is transferred to D365. The external system does not recognize the TaxItemGroup. It only gives the vendor account (which leads to a "TaxGroup") and the tax percentage, which is printed on the invoice.
  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at
    To be honest, it is hard to say whether it is correct approach or not, because T--SQL without knowing business needs is just code.  
    It could be helpful, if you could post some details from functional aspect, as asked by André as well
  • Verified answer
    DAnny3211 Profile Picture
    11,421 Super User 2026 Season 1 on at

    Hi Sebastian,

     

    In Dynamics 365 Finance there isn’t a direct one‑to‑one mapping from Sales tax group (often called “TaxGroup”) + rate to a single Item sales tax group. The engine applies tax based on the intersection of tax codes that are present in both the Sales tax group attached to the transaction and the Item sales tax group attached to the product. Practically, you’re looking for any item sales tax group that shares at least one sales tax code with your sales tax group, where that code’s effective percentage equals your target (e.g., 19%). [1][2]

     

    Functional approach (no code):

     

    1. Identify the sales tax code(s) that are set to 19% for the relevant effective date(s).

    2. For each such code, verify membership: it must be included both in your Sales tax group and in an Item sales tax group. Any item sales tax group that contains one of those codes is a candidate. The combination applies when both groups include the same code. [1][2]


    3.  
     
     

    If your environment uses the Tax Calculation service (Globalization Studio), the logic is equivalent: it uses tax group × item tax group intersection. Item tax groups there sync with item sales tax groups in Finance. [2]

     

    Query/X++ approach (conceptual):\
    You can resolve it with a join over the linking tables that associate groups to codes:

     

    • TaxGroupData → links Sales tax group to sales tax codes

    • TaxOnItem (or equivalent) → links Item sales tax group to sales tax codes\
      Joining these by TaxCode gives you item sales tax groups that intersect with your sales tax group. Then filter by the tax code value = 19% for the effective date. [3][4]


    •  
     

     

    public static void findItemSalesTaxGroups(
        TaxGroup         _salesTaxGroup,    // your Sales tax group
        real             _ratePercent,      // e.g., 19.0
        TransDate        _asOfDate)
    {
        TaxGroupData     tgd;      // Sales tax group ↔ TaxCode
        TaxOnItem        toi;      // Item sales tax group ↔ TaxCode
        TaxCode          tc;
        TaxData          tv;       // date-effective tax values (rate)
        TaxItemGroupHeading tig;   // item sales tax group header
    
        // Find item sales tax groups where there exists a code that:
        // 1) belongs to the given Sales tax group
        // 2) belongs to the item sales tax group
        // 3) has an effective percentage equal to _ratePercent on _asOfDate
        while select distinct tig.TaxItemGroup
            join toi
                where toi.TaxItemGroup  == tig.TaxItemGroup
            join tgd
                where tgd.TaxCode       == toi.TaxCode
                   && tgd.TaxGroup      == _salesTaxGroup
            join tc
                where tc.TaxCode        == tgd.TaxCode
            join firstonly tv
                where tv.TaxCode        == tc.TaxCode
                  && tv.FromDate       <= _asOfDate
                  && tv.ToDate         >= _asOfDate
                  && tv.Percent         == _ratePercent
        {
            info(strFmt("Candidate Item sales tax group: %1", tig.TaxItemGroup));
        }
    }
    

     

     
     

    The key idea is the common tax code across the two groups; the rate check comes from the tax code’s date‑effective value. The same join pattern is used when fetching tax rates programmatically. [3][4]

     

    Tip: If you need to validate this without development, create an inquiry/filter over Sales tax codes at Tax ▸ Indirect taxes ▸ Sales tax ▸ Sales tax codes, filter for 19%, then open each code and review the Sales tax groups and Item sales tax groups that include it. The overlapping item groups are the ones you’re after. [1]

     

    If this addresses your question, please mark the reply so others can find it.

     

    Thanks and best regards,\
    Daniele\
    Note: This response was prepared with support from Copilot to ensure clarity and completeness.


    References

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 591

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 550 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 543 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans