Power BI API

Overview

The Commissions & Rebates application for Microsoft Dynamics 365 Business Central exposes a dedicated set of APIs designed for integration with Power BI. These APIs allow accountants and sales operators to build rich, real-time dashboards and reports on commission and rebates contracts — replacing the need for manual Excel extractions.

Two API endpoints are available under version v1.0:

API Entity Name Purpose
Agreements agreements Lists all Commission & Rebates agreements with header and line details
Periods periods Returns periodized calculations (amounts, base values, payments) per agreement line and source

Connection Details

Use the following parameters when connecting Power BI to Dynamics 365 Business Central.

Parameter Value
Publisher bricklead
API Group commissionsAndRebates
API Version v1.0

The base URL follows the standard Dynamics 365 Business Central API pattern:

https://api.businesscentral.dynamics.com/v2.0/{tenantId}/{environmentName}/api/bricklead/commissionsAndRebates/v1.0/companies({companyId})/

Replace {tenantId}, {environmentName}, and {companyId} with the values corresponding to your environment.


Permissions

To access these APIs, the user account used for the Power BI connection must have at minimum the Commissions and Rebates Read permission set assigned in Dynamics 365 Business Central.

Refer to the Commissions & Rebates Setup page for details on available permission sets.


API: Agreements

Endpoint: .../agreements

This API returns the complete list of Commission & Rebates agreements, including contract identification, validity periods, payment configuration, and agreement lines with their calculation rules.

Use this endpoint to report on which agreements exist, their current status, applicable parties, and the structure of each agreement line.

Agreement Header Fields

Field Name Description
number Unique identifier of the agreement.
agreementType Indicates whether the agreement is a commission or a rebate.
agreementCategory Category assigned to the agreement for classification purposes.
status Current status of the agreement (e.g., New, Active, Closed).
description Main description of the agreement.
description2 Secondary description line.
startingDate Date from which the agreement is valid.
endingDate Date on which the agreement expires.
externalReference Reference code used by an external party (e.g., a customer or vendor contract number).
reference Internal reference (Your Reference).
blockedForPayment Indicates whether the agreement is currently blocked from generating payments.
salespersonPurchaserCode The salesperson or purchaser associated with the agreement.
paymentType Defines the type of payment recipient (Customer, Vendor, or Employee).
paymentToNo Identifies the specific party to whom payment is issued.
paymentPeriodicity Defines the frequency at which payments are triggered.
lastPeriodPosted The last period for which a payment was posted.
genProdPostingGroup General product posting group used for accounting.
vatProdPostingGroup VAT product posting group used for tax purposes.
globalDimension1Code Value for Global Dimension 1 assigned to the agreement.
globalDimension2Code Value for Global Dimension 2 assigned to the agreement.

Custom Attribute Fields

The agreement API also exposes up to 10 configurable attribute fields per agreement (attributes 1 through 10). Each attribute supports the following data types:

Attribute Field Pattern Description
attribute{N}Date Date-type custom attribute (e.g., attribute1Date).
attribute{N}Decimal Decimal-type custom attribute.
attribute{N}Integer Integer-type custom attribute.
attribute{N}Option Option/enum-type custom attribute.
attribute{N}Text Free text custom attribute.

These attributes correspond to the custom priority fields configured in your Commissions & Rebates setup and may carry business-specific labels (e.g., contract renewal date, priority segment, etc.).

Agreement Line Fields

Each agreement can contain one or more lines that define how calculations are performed. Lines are returned nested within each agreement record.

Field Name Description
lineNumber Sequential number identifying the line within the agreement.
lineDescription Description of the agreement line.
computationMode Defines how the commission or rebate amount is computed (e.g., by percentage, fixed amount).
distributionBase Indicates the base value used to compute the agreement line (e.g., net sales amount).
distributionPeriod Defines the time period used as the base for distribution calculations.

API: Periods

Endpoint: .../periods

This API returns periodized commission and rebate calculations. For each active agreement period, it provides the calculated amount, the base amount from which it was derived, and the amounts already paid — broken down by item and by source (customer or vendor).

Use this endpoint to report on the financial situation of each agreement per period — equivalent to the previously used “Sales Deferred Situation” report.

This API computes its data dynamically at the time of the call. It does not return a static snapshot.

Period Fields

Field Name Description
agreementNumber Identifier of the agreement to which this period record belongs.
agreementLineNumber Identifier of the agreement line to which this period record belongs.
startingDate Start date of the calculation period.
endingDate End date of the calculation period.
itemNo Item number associated with this calculation detail. Blank on payment summary rows.
sourceType Indicates whether the source is a Customer or a Vendor. Blank on payment summary rows.
sourceNo Identifies the specific customer or vendor. Blank on payment summary rows.
amount Calculated commission or rebate amount (in local currency) for this period and item/source combination.
baseAmount The base value (e.g., net sales) from which the commission or rebate amount was calculated.
paidAmount Total amount already paid for this period.
paymentAmountReferenceDate The calculated payment amount as of the agreement reference date.

Record Types Returned

The Periods API returns two types of rows for each agreement period:

  • Detail rows — One row per unique combination of Item, Source Type, and Source No. within the period. These rows contain amount and baseAmount values.
  • Payment summary rows — One row per period (Item No., Source Type, and Source No. are blank). These rows contain the paidAmount and paymentAmountReferenceDate values for the period as a whole.

This structure allows Power BI reports to show both the breakdown of accrued amounts by item and customer/vendor, and the global paid amount per period.


Typical Power BI Use Cases

The following scenarios are supported by combining data from both APIs:

  • Agreement status overview — List all active agreements, their parties, and their validity periods.
  • Deferred sales situation — Replicate the Sales Deferred Situation view by joining period records with agreement data, showing accrued amounts vs. payments per period.
  • Commission tracking by salesperson — Filter agreements by salespersonPurchaserCode and display accrued vs. paid commissions.
  • Rebate balance by customer or vendor — Group period records by sourceType and sourceNo to show outstanding balances.
  • Period-by-period payment follow-up — Compare amount (accrued) with paidAmount to identify unpaid periods.

Previous
Next