A dataset contains information about leads, deals, companies, and other Bitrix24 items. Each item has several datasets that automatically receive data from system and custom fields. Use datasets to create charts and analyze business efficiency metrics. Charts show which ads attract clients and which products sell more often. You can also merge datasets — for example, deal data and custom fields.
In this article, you'll learn about datasets for deals, how to merge them, and how to create charts.
Datasets:
- crm_deal — deals
- crm_deal_uf — deal custom fields
- crm_deal_stage_history — deal stage history
- crm_deal_product_row — products in deals
Examples:
Choose a dataset
To analyze information in a dashboard, choose a suitable dataset and create a chart.
crm_deal — deals. This dataset contains data from deal system fields, including names, stages, responsible persons, amounts, sources, and more. Use this dataset to analyze the pipeline and sales results.
crm_deal
| Field | Description | Data type |
|---|---|---|
| ID | Deal ID | Number |
| DATE_CREATE | Date and time the deal was created | Date and time |
| CREATED_BY_ID | ID of the employee who created the deal | Number |
| CREATED_BY | ID and name of the employee who created the deal | String |
| CREATED_BY_NAME | Name of the employee who created the deal | String |
| DATE_MODIFY | Date and time the deal was last modified | Date and time |
| MODIFY_BY_ID | ID of the employee who modified the deal | Number |
| MODIFIED_BY | ID and name of the employee who modified the deal | String |
| MODIFIED_BY_NAME | Name of the employee who modified the deal | String |
| ASSIGNED_BY_ID | ID of the employee responsible for the deal | Number |
| ASSIGNED_BY | ID and name of the employee responsible for the deal | String |
| ASSIGNED_BY_DEPARTMENT | Path in the department hierarchy of the responsible employee | String |
| ASSIGNED_BY_NAME | Name of the employee responsible for the deal | String |
| MOVED_BY_ID | ID of the employee who changed the deal stage | Number |
| MOVED_BY | ID and name of the employee who changed the deal stage | String |
| MOVED_BY_NAME | Name of the employee who changed the deal stage | String |
| MOVED_TIME | Date and time the deal stage was changed | Date and time |
| LEAD_ID | ID of the lead the deal was created from | Number |
| COMPANY_NAME | Name of the company linked to the deal | String |
| COMPANY_ID | ID of the company linked to the deal | Number |
| COMPANY | ID and name of the company linked to the deal | String |
| MYCOMPANY_ID | ID of the company from the My company details section linked to the deal | Number |
| MYCOMPANY_NAME | Name of the company from the My company details section linked to the deal | String |
| MYCOMPANY | ID and name of the company from the My company details section linked to the deal | String |
| CONTACT_ID | ID of the primary contact linked to the deal | Number |
| CONTACT_NAME | Name of the primary contact linked to the deal | String |
| CONTACT | ID and name of the primary contact linked to the deal | String |
| CONTACT_IDS | IDs of all contacts linked to the deal | String |
| CONTACTS | IDs and names of all contacts linked to the deal | String |
| OPENED | Shows whether the deal is available to everyone: Y — yes, N — no |
String |
| TITLE | Deal name | String |
| CRM_PRODUCT | IDs and names of products or services in the deal | String |
| CATEGORY_ID | Deal pipeline ID | Number |
| CATEGORY_NAME | Deal pipeline name | String |
| CATEGORY | ID and name of the deal pipeline | String |
| STAGE_ID | Deal stage code | String |
| STAGE_NAME | Deal stage name | String |
| STAGE | Code and name of the deal stage | String |
| PREVIOUS_STAGE_ID | Code of the previous deal stage | String |
| PREVIOUS_STAGE_NAME | Name of the previous deal stage | String |
| PREVIOUS_STAGE | Code and name of the previous deal stage | String |
| STAGE_SEMANTIC_ID | Stage type code: F — failed, S — success, P — in progress |
String |
| STAGE_SEMANTIC | Stage type: failure, success, in progress | String |
| IS_NEW | Shows whether the deal is in the first stage: Y — yes, N — no |
String |
| IS_RECURRING | Shows whether recurring deals are created from the deal template: Y — yes, N — no |
String |
| IS_RETURN_CUSTOMER | Shows whether the deal is a repeat inquiry: Y — yes, N — no |
String |
| CLOSED | Shows whether the deal is in a final stage: Y — yes, N — no |
String |
| TYPE_ID | Deal type code | String |
| TYPE_NAME | Deal type name | String |
| OPPORTUNITY_ACCOUNT | Expected amount in the reporting currency | Number |
| OPPORTUNITY | Expected deal amount | Number |
| IS_MANUAL_OPPORTUNITY | Shows whether the expected amount was entered manually: Y — yes, N — no |
String |
| TAX_VALUE | Deal tax amount | Number |
| TAX_VALUE_ACCOUNT | Tax amount in the reporting currency | Number |
| CURRENCY_ID | Deal currency code | String |
| ACCOUNT_CURRENCY_ID | Reporting currency code | String |
| PROBABILITY | Probability of successfully closing the deal | Number |
| COMMENTS | Comments in the deal | String |
| BEGINDATE | Date and time the deal was opened | Date and time |
| CLOSEDATE | Planned date and time the deal will close | Date and time |
| LOCATION_ID | Client location ID | Number |
| SOURCE_ID | Deal source code | String |
| SOURCE_NAME | Deal source name | String |
| SOURCE | Code and name of the deal source | String |
| SOURCE_DESCRIPTION | Deal source description | String |
| ORIGINATOR_ID | ID of the external system where the deal was created | String |
| ORIGIN_ID | Deal ID in the external system | String |
| ADDITIONAL_INFO | Additional information about the deal | String |
| UTM_SOURCE | Value of the utm_source parameter — traffic source | String |
| UTM_MEDIUM | Value of the utm_medium parameter — traffic type | String |
| UTM_CAMPAIGN | Value of the utm_campaign parameter — ad campaign | String |
| UTM_CONTENT | Value of the utm_content parameter — ad content | String |
| UTM_TERM | Value of the utm_term parameter — keyword | String |
| BANK_DETAIL_ID | Bank details ID | Number |
| CRM_PRODUCT_ID | IDs of product or service rows in the deal | String |
| CRM_PRODUCT_COUNT | Quantity of each product or service in the deal | String |
| WEBFORM_ID | ID of the CRM form the deal was created from | Number |
| WEBFORM_NAME | Name of the CRM form the deal was created from | String |
| WEBFORM | ID and name of the CRM form the deal was created from | String |
crm_deal_uf — deal custom fields. This dataset contains data from custom fields you create, such as delivery deadline and order number. Use this dataset to add your own deal parameters to reports.
crm_deal_uf
| Field | Description | Data type |
|---|---|---|
| DEAL_ID | Deal ID | Number |
| DATE_CREATE | Date and time the deal was created | Date and time |
| CLOSEDATE | Planned date and time the deal will close | Date and time |
| UF_CRM_"field number" | Value of the custom field with the specified number, for example UF_CRM_123456789. The number is assigned automatically when the field is created. |
String |
crm_deal_stage_history — deal stage history. This dataset contains data from system fields for deal stage history, including transition dates, stages, responsible persons, pipelines, and more. Use this dataset to analyze how deals move through stages and how long they stay at each stage.
crm_deal_stage_history
| Field | Description | Data type |
|---|---|---|
| ID | Stage history record ID | Number |
| TYPE_ID | Record type: 1 — deal creation, 2 — transition to an intermediate stage, 3 — transition to a final stage |
Number |
| DEAL_ID | ID of the deal whose stage changed | Number |
| DATE_CREATE | Date and time the stage history record was created | Date and time |
| START_DATE | Stage start date | Date |
| END_DATE | Stage end date | Date |
| ASSIGNED_BY_NAME | Name of the employee responsible for the deal | String |
| ASSIGNED_BY_ID | ID of the employee responsible for the deal | Number |
| ASSIGNED_BY | ID and name of the employee responsible for the deal | String |
| ASSIGNED_BY_DEPARTMENT | Path in the department hierarchy of the responsible employee | String |
| STAGE_SEMANTIC_ID | Stage type code: F — failed, S — success, P — in progress |
String |
| STAGE_SEMANTIC | Stage type: failure, success, in progress | String |
| STAGE_ID | Deal stage code | String |
| STAGE | Code and name of the deal stage | String |
| STAGE_NAME | Deal stage name | String |
| CATEGORY | ID and name of the deal pipeline | String |
| CATEGORY_NAME | Deal pipeline name | String |
| CATEGORY_ID | Deal pipeline ID | Number |
crm_deal_product_row — products in deals. This dataset contains data from system fields for products and services in deals, including names, prices, quantities, discounts, taxes, and more. Use this dataset to analyze product and service sales.
crm_deal_product_row
| Field | Description | Data type |
|---|---|---|
| ID | Product or service record ID | Number |
| DEAL_ID | Deal ID | Number |
| DEAL_DATE_CREATE | Date and time the deal was created | Date and time |
| DEAL_CLOSEDATE | Planned date and time the deal will close | Date and time |
| PRODUCT | ID and name of the product or service | String |
| PRODUCT_ID | ID of the product or service | Number |
| PRODUCT_NAME | Name of the product or service | String |
| PRICE | Price of the product or service | Number |
| PRICE_EXCLUSIVE | Price of the product or service without tax, with discount | Number |
| PRICE_NETTO | Price of the product or service without discounts or taxes | Number |
| PRICE_BRUTTO | Price of the product or service without discounts, with tax | Number |
| QUANTITY | Quantity of the product or service | Number |
| SUM_NETTO | Amount for the product or service without discounts or taxes | Number |
| SUM_EXCLUSIVE | Amount for the product or service without tax, with discount | Number |
| SUM_TOTAL | Total amount for the product or service with discount and tax | Number |
| CURRENCY_ID | Deal currency code used to calculate amounts for the product or service | String |
| DISCOUNT_TYPE | Discount code and name | String |
| DISCOUNT_TYPE_ID | Discount code | Number |
| DISCOUNT_TYPE_NAME | Discount name | String |
| DISCOUNT_RATE | Discount rate, % | Number |
| DISCOUNT_SUM | Discount amount | Number |
| TAX_RATE | Tax rate, % | Number |
| TAX_INCLUDED | Shows whether tax is included in the price: Y — yes, N — no |
String |
| CUSTOMIZED | Shows whether the product or service was manually modified after being added to the deal: Y — yes, N — no |
String |
| MEASURE | Unit of measurement code and name | String |
| MEASURE_CODE | Unit of measurement code | Number |
| MEASURE_NAME | Unit of measurement name | String |
| SORT | Sort order of the product or service | Number |
| CATEGORY | ID and name of the deal pipeline | String |
| CATEGORY_NAME | Deal pipeline name | String |
| PARENT | Product section | String |
| SUPERPARENT | Product section one level up | String |
| SUPERSUPERPARENT | Product section two levels up | String |
Create a chart
Add information from a dataset to charts and track business metrics.
- Open BI Builder > Charts.
- Click + Chart in the top-right corner.
- Choose a dataset from the list. If you do not see the dataset you need, click Add a dataset.
Create a dataset - Choose a chart type — the format for viewing the information, such as a card, table, line chart, or another option.
- Click Create new chart.
Merge datasets
Merge datasets to include information from a deal's system and custom fields in a report.
- Open BI Builder > SQL > SQL Lab.
- Make sure
bitrix24is selected in the Schema field. - Enter the SQL query and click Run.
- Review the query results. To create a chart for a report, save the query as a dataset. The dataset receives data from the fields specified in the SQL query.
Create a chart from a virtual dataset
If this is your first time merging datasets, see the sample query.
Example SQL query
This SQL query extracts data from two datasets: deals (crm_deal) and deal custom fields (crm_deal_uf). You can copy it to see how the query works. Before running the query, replace UF_CRM_"field number" with your custom field.
SELECT
crm_deal.ID AS "Deal ID",
crm_deal.TITLE AS "Deal name",
crm_deal.DATE_CREATE AS "Deal creation date",
crm_deal.OPPORTUNITY AS "Deal amount",
crm_deal_uf.UF_CRM_1723105561632 AS "Custom field"
FROM
crm_deal
INNER JOIN
crm_deal_uf ON crm_deal.ID = crm_deal_uf.DEAL_ID
WHERE
crm_deal_uf.UF_CRM_1723105561632 IS NOT NULL
AND crm_deal_uf.UF_CRM_1723105561632 <> ''
SELECT determines which information to extract from the dataset. For example, the query SELECT crm_deal.ID AS "Deal ID":
- Selects the deal ID
IDfrom thecrm_dealdataset - Assigns it the name
Deal ID - Displays the result in a separate table column
FROM specifies the main dataset that the data comes from. In this example, it is crm_deal.
INNER JOIN links datasets and combines their information. The query crm_deal_uf ON crm_deal.ID = crm_deal_uf.DEAL_ID links system and custom field information by deal ID.
WHERE filters the results and shows only deals with a non-empty custom field.
In brief
- A dataset contains information about leads, deals, companies, and other Bitrix24 items.
- Each item has several datasets that automatically receive data from system and custom fields.
- Deals have four datasets: deals (crm_deal), deal custom fields (crm_deal_uf), deal stage history (crm_deal_stage_history), and products and services in deals (crm_deal_product_row).
- Use datasets to create charts and analyze business efficiency metrics. Charts can show which products sell more often or which ads attract clients.
- Merge datasets to include information from deal system and custom fields in a report. Write an SQL query, save the result as a dataset, and create a chart.