A dataset contains information about invoices, estimates, products, 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 metrics.
In this article, you'll learn about datasets for invoices and estimates, how to merge them, and how to create charts.
Datasets:
- crm_dynamic_items_31 — invoices
- crm_quote — estimates
- crm_quote_uf — estimate custom fields
- crm_quote_product_row — products in estimates
Examples:
Choose a dataset
To analyze information in a dashboard, choose a suitable dataset and create a chart.
crm_dynamic_items_31 — invoices. This dataset contains data from invoice system fields. Use this dataset to see the invoice stage, who created it, and which client it is linked to.
crm_dynamic_items_31
| Field | Description | Data type |
|---|---|---|
| ID | Invoice ID | Number |
| XML_ID | External invoice ID | String |
| TITLE | Invoice name | String |
| CREATED_BY_ID | ID of the user who created the invoice | Number |
| CREATED_BY_NAME | Name of the user who created the invoice | String |
| CREATED_BY | ID and name of the user who created the invoice | String |
| UPDATED_BY_ID | ID of the user who last modified the invoice | Number |
| UPDATED_BY_NAME | Name of the user who last modified the invoice | String |
| UPDATED_BY | ID and name of the user who last modified the invoice | String |
| MOVED_BY_ID | ID of the user who changed the stage | Number |
| MOVED_BY_NAME | Name of the user who changed the stage | String |
| MOVED_BY | ID and name of the user who changed the stage | String |
| CREATED_TIME | Creation date and time | Date |
| UPDATED_TIME | Change date and time | Date |
| MOVED_TIME | Stage change date and time | Date |
| CATEGORY_ID | Pipeline ID | Number |
| CATEGORY_NAME | Pipeline name | String |
| CATEGORY | Pipeline name and ID | String |
| OPENED | Shows whether the invoice is available to everyone: Y — yes, N — no |
String |
| STAGE_ID | Stage ID | String |
| STAGE_NAME | Stage name | String |
| STAGE | Stage name and ID | String |
| PREVIOUS_STAGE_ID | Previous stage ID | String |
| BEGINDATE | Start date and time | Date |
| CLOSEDATE | End date and time | Date |
| COMPANY_ID | Company ID | Number |
| COMPANY_NAME | Company name | String |
| COMPANY | Company name and ID | String |
| CONTACT_ID | Contact ID | Number |
| CONTACT_NAME | Contact name | String |
| CONTACT | Contact name and ID | String |
| CONTACTS | IDs and names of all contacts linked to the invoice | String |
| OPPORTUNITY | Expected amount | Number |
| IS_MANUAL_OPPORTUNITY | Shows whether the expected amount was entered manually: Y — yes, N — no |
String |
| TAX_VALUE | Tax | Number |
| CURRENCY_ID | Invoice currency ID | String |
| OPPORTUNITY_ACCOUNT | Amount in reporting currency | Number |
| TAX_VALUE_ACCOUNT | Tax in reporting currency | Number |
| ACCOUNT_CURRENCY_ID | Reporting currency ID | String |
| MYCOMPANY_ID | My company ID | Number |
| MYCOMPANY_NAME | My company name | String |
| MYCOMPANY | My company name and ID | String |
| SOURCE_ID | Source ID | String |
| SOURCE_NAME | Source name | String |
| SOURCE | Source name and ID | String |
| SOURCE_DESCRIPTION | Source description | String |
| ASSIGNED_BY_ID | Responsible person's ID | Number |
| ASSIGNED_BY_NAME | Responsible person's name | String |
| ASSIGNED_BY | Responsible person's ID and name | String |
| WEBFORM_ID | Source CRM form ID | Number |
| COMMENTS | Invoice comments | String |
UF_CRM_"field number" |
Data from the invoice custom field, for example UF_CRM_123456789 |
Depends on the field type |
crm_quote — estimates. This dataset contains data from estimate system fields. Use this dataset to track estimate statuses and amounts.
crm_quote
| Field | Description | Data type |
|---|---|---|
| ID | Estimate ID | Number |
| DATE_CREATE | Estimate creation date and time | Date |
| DATE_MODIFY | Estimate change date and time | Date |
| CREATED_BY_ID | ID of the user who created the estimate | Number |
| CREATED_BY_NAME | Name of the user who created the estimate | String |
| CREATED_BY | ID and name of the user who created the estimate | String |
| MODIFY_BY_ID | ID of the user who last modified the estimate | Number |
| MODIFIED_BY_NAME | Name of the user who last modified the estimate | String |
| MODIFIED_BY | ID and name of the user who last modified the estimate | String |
| ASSIGNED_BY_ID | ID of the person responsible for the estimate | String |
| ASSIGNED_BY_NAME | Name of the person responsible for the estimate | String |
| ASSIGNED_BY | ID and name of the person responsible for the estimate | String |
| ASSIGNED_BY_DEPARTMENT | Responsible person's department | String |
| OPENED | Shows whether the estimate is available to everyone: Y — yes, N — no |
String |
| LEAD_ID | Lead ID | Number |
| DEAL_ID | Deal ID | Number |
| COMPANY_ID | Company ID | Number |
| COMPANY_NAME | Company name | String |
| COMPANY | Company ID and name | String |
| CONTACT_ID | Contact ID | Number |
| CONTACT_NAME | Contact name | String |
| CONTACT | Contact ID and name | String |
| PERSON_TYPE_ID | Payer type ID | Number |
| MYCOMPANY_ID | Estimate issued by company ID | Number |
| MYCOMPANY_NAME | Estimate issued by company name | String |
| MYCOMPANY | Estimate issued by company ID and name | String |
| TITLE | Estimate name | String |
| STATUS_ID | Status ID | String |
| STATUS_NAME | Status name | String |
| STATUS | Status | String |
| CLOSED | Shows whether the estimate is closed: Y — yes, N — no |
String |
| OPPORTUNITY | Expected amount | Number |
| TAX_VALUE | Tax | Number |
| CURRENCY_ID | Currency | String |
| OPPORTUNITY_ACCOUNT | Amount in reporting currency | Number |
| TAX_VALUE_ACCOUNT | Tax in reporting currency | Number |
| ACCOUNT_CURRENCY_ID | Reporting currency | String |
| COMMENTS | Comments | String |
| BEGINDATE | Date estimate opened | Date and time |
| CLOSEDATE | Date estimate closed | Date and time |
| QUOTE_NUMBER | Estimate number | String |
| CONTENT | Estimate text | String |
| TERMS | Conditions | String |
| LOCATION_ID | Location | Number |
| WEBFORM_ID | ID of the CRM form the estimate was created from | Number |
| WEBFORM_NAME | Name of the CRM form the estimate was created from | String |
| WEBFORM | ID and name of the CRM form the estimate was created from | String |
| ACTUAL_DATE | Estimate validity date | Date |
| UTM_SOURCE | Ad source, UTM_SOURCE in the estimate form | String |
| UTM_MEDIUM | Ad medium, UTM_MEDIUM in the estimate form | String |
| UTM_CAMPAIGN | Ad campaign, UTM_CAMPAIGN in the estimate form | String |
| UTM_CONTENT | Ad content, UTM_CONTENT in the estimate form | String |
| UTM_TERM | Ad term, UTM_TERM in the estimate form | String |
crm_quote_uf — estimate custom fields. This dataset contains data from custom fields you created, such as estimate validity period or an extra discount.
crm_quote_uf
| Field | Description | Data type |
|---|---|---|
| QUOTE_ID | Estimate ID | Number |
| DATE_CREATE | Estimate creation date and time | Date and time |
| CLOSEDATE | Estimate completion date and time | Date and time |
UF_CRM_"field number" |
Data from the estimate custom field, for example UF_CRM_123456789 |
Depends on the field type |
crm_quote_product_row — products in estimates. This dataset contains data about products and services in estimates. Use this dataset to analyze estimate contents and track price changes.
crm_quote_product_row
| Field | Description | Data type |
|---|---|---|
| ID | ID of the product or service record in the estimate | Number |
| QUOTE_ID | Estimate ID | Number |
| QUOTE_DATE_CREATE | Estimate creation date and time | Date |
| QUOTE_CLOSEDATE | Estimate closure date and time | Date |
| PRODUCT | Product name and ID | String |
| PRODUCT_ID | Product ID | Number |
| PRODUCT_NAME | Product name | String |
| PRICE | Product price | Number |
| PRICE_EXCLUSIVE | Discounted price without tax | Number |
| PRICE_NETTO | Price without discount or tax | Number |
| PRICE_BRUTTO | Price with tax, but without discount | Number |
| QUANTITY | Product quantity | Number |
| DISCOUNT_TYPE | Discount name and ID | String |
| DISCOUNT_TYPE_ID | Discount ID | Number |
| DISCOUNT_TYPE_NAME | Discount name | String |
| DISCOUNT_RATE | Discount percentage value | Number |
| DISCOUNT_SUM | Discount amount | Number |
| TAX_RATE | Tax percentage rate | Number |
| TAX_INCLUDED | Shows whether tax is included in the price: Y — yes, N — no |
String |
| CUSTOMIZED | Shows whether the product was modified manually: Y — yes, N — no |
String |
| MEASURE | Unit of measurement ID and name | String |
| MEASURE_CODE | Unit of measurement ID | Number |
| MEASURE_NAME | Unit of measurement name | String |
| SORT | Sorting order | Number |
| PARENT | Product section | String |
| SUPERPARENT | Catalog section one level up | String |
| SUPERSUPERPARENT | Catalog section two levels up | String |
Create a chart
Add information from a dataset to charts and track estimate stages and responsible persons.
- 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 estimate and product data to see which products are included in estimates.
- 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: estimates (crm_quote) and products in estimates (crm_quote_product_row). You can copy it to see how the query works. The query shows the responsible person, products, and prices. Replace the employee name before running the query.
SELECT
crm_quote.ID AS "Estimate ID",
crm_quote.TITLE AS "Estimate name",
crm_quote.ASSIGNED_BY_NAME AS "Responsible person",
crm_quote_product_row.PRODUCT_NAME AS "Product name",
crm_quote_product_row.QUANTITY AS "Quantity",
crm_quote_product_row.PRICE AS "Price"
FROM crm_quote
LEFT JOIN crm_quote_product_row
ON crm_quote.ID = crm_quote_product_row.QUOTE_ID
WHERE crm_quote.ASSIGNED_BY_NAME = 'Justin Testard';
SELECT determines which information to extract from the dataset. For example, SELECT crm_quote.ID AS "Estimate ID":
- Selects the estimate ID from the
crm_quotedataset - Names it
Estimate ID - Shows the result as a separate column in the table
FROM specifies the main dataset the data comes from. Here it is crm_quote, the table with estimate information.
LEFT JOIN connects the crm_quote table with crm_quote_product_row. The query links estimates to products added to the estimate form.
WHERE filters the results and shows only estimates for a specific person. The condition crm_quote.ASSIGNED_BY_NAME = 'Justin Testard' keeps estimates assigned to that user. To see estimates for all employees, remove the WHERE condition.
In brief
- A dataset contains information about invoices, estimates, products, and other Bitrix24 items.
- Each item has several datasets that automatically receive data from system and custom fields.
- There are four datasets for invoices and estimates: invoices (crm_dynamic_items_31), estimates (crm_quote), estimate custom fields (crm_quote_uf), and products in estimates (crm_quote_product_row).
- Use datasets to create charts and analyze metrics, such as created estimates and who is responsible for them.
- Merge datasets to see which products are included in estimates. Write an SQL query, save the result as a dataset, and create a chart.