pixiReport_NewCustomersStats
Returns a monthly report for one year that compares order counts, order values and averages of new customers with those of existing customers.
Builds a pivoted report with one row per report line and one column per month (Month01–Month12) plus an Average column.
Parameters and filters
Yeardefaults to the current year ifNULL.Shop(compared withCustomers.CustomerOf) andCountry(compared with the country of the order line address) are optional; an empty string is treated likeNULL, i.e. no filter.
New customers
A customer counts as new in a month if the earliest OrderDate of all his order lines (within the shop/country filter) lies in that month of Year. Only the order lines with exactly this first order date are treated as the new-customer order; further orders in the same month count as orders of existing customers.
Report lines (GroupNumber / LineNumber)
- Group 1 – order counts:
- 1
Orders new customers: number of customers whose first order falls in the month. - 2
Orders customers: line 3 minus line 1. - 3
Total: number of distinct order numbers in the month, excluding order lines with statusSTOorNLB. - 4
rate new customers: line 1 / line 3 × 100 (0 if line 3 is 0).
- 1
- Group 2 – order values (sum of
OrderLineAmount, order lines with statusSTO/NLBexcluded):- 5 value of first orders of new customers.
- 6 line 7 minus line 5.
- 7
Total: value of all order lines of the month. - 8 share of new customers (line 5 / line 7 × 100), 9 share of existing customers (line 6 / line 7 × 100).
- Group 3 – averages per order line:
- 10 average
OrderLineAmountof all candidate order lines in the month. - 11 average
OrderLineAmountof the first-order lines of new customers.
- 10 average
Average column: the arithmetic mean of the monthly values that exist for the line.
Rows are sorted by LineNumber. The columns ParYear, ParShop and ParCountry echo the effective parameters; dbCurrency contains the database currency code if multi-currency is enabled.
Notes
- Multi-currency: if the setting
MultiCurrencyEnabledis1, order values are converted into the database currency (settingHomeCurrency, exchange rate source fromDatabaseCurrencyExchRateSourceId) usingpixi.ExchRateof the order header's exchange date. Order lines without matchingOrderHeader/ exchange rate then drop out of the value lines. Otherwise the rate is 1 anddbCurrencyisNULL. - Label pitfall: line 10 is labelled as average of new customers but averages all candidate order lines (including status
STO/NLB), while line 11 is labelled as average of customers but averages the first-order lines of new customers. Lines 10 and 11 do not excludeSTO/NLBorder lines. - Averages in group 3 are per order line, not per order.
- Lines 6, 7, 8, 9 and 10 only contain months that have order lines; other months stay
0and are not included inAverage, soAverageis the mean of the months with data only. - First orders are determined without status filter; a customer whose earliest order line has status
STO/NLBis still counted in line 1. - The new-customer determination uses inner joins on address and customer, so lines without country or
CustomerOfare not considered, while the total lines acceptNULLcountry/shop values. - A month can disappear from lines 2–4 if all its orders are removed by the filters.
- All reads use
NOLOCK(dirty reads possible). Line 3 joins order lines viaMONTH(OrderDate), which scans the wholeOrderlinestable and can be slow on large databases.
Tables used
| Parameter | Type | Default | Description |
|---|---|---|---|
Year
|
int | NULL |
Report year. Example: |
Shop
|
varchar(3) string |
NULL |
Shop ID, compared with Example: |
Country
|
varchar(3) string |
NULL |
Country code of the order line address. Example: |
Result set 1 · Always
One row per report line (up to 11), sorted by LineNumber, with monthly values and the average.
| Column | Type | Description |
|---|---|---|
GroupNumber
|
int |
Group of the line: 1 = order counts, 2 = order values, 3 = averages. |
LineNumber
|
int |
Number of the report line (1–11). |
LineLabel
|
varchar(256) string |
Fixed bilingual label of the line. |
Month01
|
float decimal |
Value for January; 0 if no value. |
Month02
|
float decimal |
Value for February. |
Month03
|
float decimal |
Value for March. |
Month04
|
float decimal |
Value for April. |
Month05
|
float decimal |
Value for May. |
Month06
|
float decimal |
Value for June. |
Month07
|
float decimal |
Value for July. |
Month08
|
float decimal |
Value for August. |
Month09
|
float decimal |
Value for September. |
Month10
|
float decimal |
Value for October. |
Month11
|
float decimal |
Value for November. |
Month12
|
float decimal |
Value for December. |
Average
|
float decimal |
Mean of the monthly values that exist for the line. |
ParYear
|
int |
Effective report year. |
ParShop
Nullable |
varchar(3) string |
Effective shop filter; |
ParCountry
Nullable |
varchar(3) string |
Effective country filter; |
dbCurrency
Nullable |
varchar(3) string |
Code of the database currency if multi-currency is enabled, otherwise |
Response example
<SqlRowSet1>
<row>
<GroupNumber>1</GroupNumber>
<LineNumber>1</LineNumber>
<LineLabel>Orders new customers (Bestellungen Neukunden)</LineLabel>
<Month01>42</Month01>
<Month02>37</Month02>
<Month03>51</Month03>
<Month04>0</Month04>
<Month05>0</Month05>
<Month06>0</Month06>
<Month07>0</Month07>
<Month08>0</Month08>
<Month09>0</Month09>
<Month10>0</Month10>
<Month11>0</Month11>
<Month12>0</Month12>
<Average>10.83</Average>
<ParYear>2024</ParYear>
<ParCountry>DE</ParCountry>
<dbCurrency>EUR</dbCurrency>
</row>
<row>
<GroupNumber>1</GroupNumber>
<LineNumber>2</LineNumber>
<LineLabel>Orders customers (Bestellungen Bestandskunden)</LineLabel>
<Month01>118</Month01>
<Month02>104</Month02>
<Month03>129</Month03>
<Month04>0</Month04>
<Month05>0</Month05>
<Month06>0</Month06>
<Month07>0</Month07>
<Month08>0</Month08>
<Month09>0</Month09>
<Month10>0</Month10>
<Month11>0</Month11>
<Month12>0</Month12>
<Average>29.25</Average>
<ParYear>2024</ParYear>
<ParCountry>DE</ParCountry>
<dbCurrency>EUR</dbCurrency>
</row>
</SqlRowSet1>
POST https://apigateway.descartes.com/tms/pixi/
Content-Type: text/xml; charset=utf-8
Authorization: Basic BASE64(USERNAME:PASSWORD)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiReport_NewCustomersStats>
<!-- <Year>2024</Year> -->
<!-- <Shop>SHP</Shop> -->
<!-- <Country>DE</Country> -->
</ns1:pixiReport_NewCustomersStats>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
curl -X POST 'https://apigateway.descartes.com/tms/pixi/' \
--user 'USERNAME:PASSWORD' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-binary @- <<'XML'
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://apigateway.descartes.com/tms/pixi/">
<SOAP-ENV:Body>
<ns1:pixiReport_NewCustomersStats>
<!-- <Year>2024</Year> -->
<!-- <Shop>SHP</Shop> -->
<!-- <Country>DE</Country> -->
</ns1:pixiReport_NewCustomersStats>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML
<?php
$soapClient = new SoapClient(null, [
'login' => 'USERNAME',
'password' => 'PASSWORD',
'location' => 'https://apigateway.descartes.com/tms/pixi/',
'uri' => 'https://apigateway.descartes.com/tms/pixi/',
]);
$arguments = [
// 'Year' => '2024',
// 'Shop' => 'SHP',
// 'Country' => 'DE',
];
$soapArguments = [];
foreach ($arguments as $name => $value) {
$soapArguments[] = new SoapVar($value, XSD_STRING, '', '', $name);
}
$response = $soapClient->__soapCall('pixiReport_NewCustomersStats', $soapArguments);
- SQL object:
- dbo.pipiReport_NewCustomersStats