# Transactions

The Transaction Table contains details of Transactions made by Customers, such as Purchases and Returns. The Transaction table has 7 Mandatory fields, as this data is required for understanding the long-term Value of every Customer for better predictions.

{% hint style="warning" %}
The primary key for this table is the combination of 5 fields: `customer_id`, `invoice_id`, `transaction_timestamp, order_type` and `item_number`. In other words, for every transaction made by a customer at a given time, each record should contain a Unique item.&#x20;
{% endhint %}

<table><thead><tr><th width="183">Field Name</th><th width="92">Data Type</th><th width="119">Example</th><th>Description</th></tr></thead><tbody><tr><td>*customer_id</td><td>string</td><td>e131498</td><td>The Customer ID; Unique identifier used for merging all tables.</td></tr><tr><td>*transaction_ timestamp</td><td>date</td><td>2013-01-17</td><td>Date and (optionally) Time of the Transaction</td></tr><tr><td>*invoice_id</td><td>string</td><td>i_1021</td><td>Unique ID of every Order; Used to track different items in the same Order, or to match Orders with Returns</td></tr><tr><td>*item_number</td><td>string</td><td>3</td><td>Item number of each item in an Order. Must not be repeated within a single Order/Invoice</td></tr><tr><td>*price</td><td>decimal</td><td>29.99<br>179</td><td>Unit Price per item. Can be Net / Gross / Discounted Price etc.</td></tr><tr><td>*order_type</td><td>string</td><td>sale<br>return<br>neutral</td><td>The Order Type ( Sale / Return / Neutral ) of each Order. By default, Sale is Positive, Return is Negative while Neutral is ignored.</td></tr><tr><td>*quantity</td><td>decimal</td><td>3.5<br>-1</td><td>Can be number of items ordered, or weight/volume. This is multiplied by price to get total value of Ordered Item.</td></tr><tr><td>gross_margin</td><td>decimal</td><td>17.04<br>29</td><td>Gross profit margin per unit. Can be used to select a Margin-based view instead of a price-based view.</td></tr><tr><td>order_channel</td><td>string</td><td><p>internet</p><p>telephone</p><p>mail</p><p>e-mail</p><p>fax</p><p>in_person</p></td><td>Information about how the order was placed. The 6 values on the left are accepted by default. For passing more values, please <a href="../../data-and-engagement-platform/help-and-support/reach-out-to-customer-support">Reach out to Customer Support</a>.</td></tr><tr><td>productgroup_id</td><td>string</td><td>clothing<br>furniture</td><td>Category to which product belongs to. Ideally, this should not have more than 20 Unique entries.</td></tr><tr><td>productgroup_id2</td><td>string</td><td>shirts<br>shoes</td><td>A finer product group can be passed in this field to create finer NBO models in expert mode.</td></tr><tr><td>productgroup_id3</td><td>string</td><td>t-shirts<br>sneakers</td><td>In this field an even finer product group can be passed to create finer NBO models in expert mode.</td></tr><tr><td>product_id</td><td>string</td><td>p063</td><td>This field is only used if referenced in expert mode. May then be used to compute product specific models.</td></tr><tr><td>return_reason</td><td>string</td><td>NULL<br>wrong size</td><td>The reason for return or cancellation.</td></tr><tr><td>voucher</td><td>string</td><td>8WBA2TV</td><td>The presence or type of a voucher can be stored here; Used as Categories for Pattern Recognition.</td></tr><tr><td>size</td><td>string</td><td>XL<br>12L</td><td>This field can be used for Prediction Models; It also serves as a feature to analyze frequency distribution of different sizes.</td></tr><tr><td>product_supplier</td><td>string</td><td>IKEA<br>S123</td><td>This field can be used for Prediction Models; It also serves as a feature to analyze frequency distribution of different Suppliers.</td></tr></tbody></table>
