> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xpertai.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 🤖 AI Assistant

For general AI Assistant functionality, please refer to [🤖 AI Assistant](../../ai/copilot/).

Semantic Model Copilot Command List:

| Command                      | Description                      |
| ---------------------------- | -------------------------------- |
| [`/table`](#table)           | Create physical table            |
| [`/dimension`](#dimension)   | Create shared dimension          |
| [`/hierarchy`](#hierarchy)   | Create hierarchy                 |
| [`/cube`](#cube)             | Create multidimensional dataset  |
| [`/query`](#query)           | Create query statement           |
| [`/calculated`](#calculated) | Create calculated member command |
| [`/modeler`](#modeler)       | Modeler command                  |

## Model Global Commands

In the semantic model interface, the AI Assistant has the following commands available:

* `/table` `/t` [🦜️🔗][🦜️🔗] Create physical table
* `/dimension` `/d` [🦜️🔗][🦜️🔗] Create dimension
* `/cube` `/c` [🦜️🔗][🦜️🔗] Create cube

### /table

The `/table` or `/t` [🦜️🔗][🦜️🔗] command is used to create physical tables.

### /dimension

The `/dimension` `/d` [🦜️🔗][🦜️🔗] command is used to create shared dimensions based on table information and questions.

<Tip>
  Users need to provide necessary dimension table information. You can drag table names from the data table area into the copilot to insert metadata into the conversation.
</Tip>

Example:

```bash theme={null}
/d create dimension call 'product_category' includes product category and model levels.
```

### /cube

The `/cube` `/c` [🦜️🔗][🦜️🔗] command is used to create cubes based on table information and questions.

<Tip>
  Users need to provide necessary cube information. You can drag table names from the data table area into the copilot to insert metadata into the conversation.
</Tip>

Example:

```bash theme={null}
/cube create cube call 'sales_cube' that includes shared dimensions: product and customer, and measures: sales amount, product cost, sales profit
```

## Query Lab Commands

In the Query Lab interface, the AI Assistant has the following commands available:

* `/query` [🦜️🔗][🦜️🔗] Execute data queries based on user descriptions;

Copilot conversation content in this interface can be saved in query records. When users reopen a query, the copilot conversation content will be restored. For more Query Lab functionality, please refer to [Query Lab](../query-lab/)

### /query

The `/query` `/q` [🦜️🔗][🦜️🔗] command is used to execute data queries based on user descriptions. Users need to provide necessary query logic information and table information.

<Tip>
  Users can drag table names from the table area to the **Table Structure** area to provide necessary table information.
</Tip>

```sql theme={null}
/query Customer sales by country and year

SELECT
    c.country_region,
    SUBSTRING(s.order_date_key, 1, 4) AS year,
    SUM(s.sales_amount) AS total_sales_amount
FROM
    adv_sales s
    JOIN adv_customer c ON s.customer_key = c.customer_key
GROUP BY
    c.country_region,
    year
ORDER BY
    c.country_region,
    year;
```

The query will be automatically executed and results returned when the command completes.

Modify query statement:

```bash theme={null}
/query Change the country field to city field
```

### Querying Multidimensional Data Sources

If the semantic model's corresponding data source is a multidimensional data source (such as SAP BW, Microsoft Analysis Services, and other systems supporting Xmla interface services), the Query command automatically uses MDX syntax statements for queries.

```sql theme={null}
/query sum SignData for every entity where category is [/CPMB/OUDV1E2].[Actual]

SELECT
  {[Measures].[/CPMB/SDATA]} ON COLUMNS,
  {[/CPMB/OUDMS0O].[LEVEL01].Members} ON ROWS
FROM [$/CPMB/OUMFJWF]
WHERE {[/CPMB/OUDV1E2].[Actual]}
```

## Dimension Interface Commands

The following commands are available:

* `/hierarchy` `/h` [🦜️🔗][🦜️🔗] Create new hierarchy based on user description

### /hierarchy

The `/hierarchy` `/h` [🦜️🔗][🦜️🔗] command is used to create new hierarchies

<Tip>
  Users need to drag the tables to be used from the data table area into the AI dialog box to provide necessary dimension table information. If table information is not provided, the copilot will only create hierarchies based on table information used in the current dimension.
</Tip>

Example:

```bash theme={null}
/h Create hierarchy including product and category
```

## Dataset Commands

The following commands are available:

* `/calculated` `/calc` [🦜️🔗][🦜️🔗] Create new calculated member;

Query Interface

* `/query` `/q` [🦜️🔗][🦜️🔗] Execute data queries based on user description

Calculation Interface

* `/formula` `/f` [🦜️🔗][🦜️🔗] Modify the current calculation formula based on user description.

### /query

The `/query` `/q` [🦜️🔗][🦜️🔗] command is used to execute data queries based on user descriptions.

```bash theme={null}
/query Create a statement to query the data: the most sales reseller
```

The `/query` command can also modify query statements in the current editor:

```bash theme={null}
/query Edit current statement refer to the error message: MDX object '[Reseller].[Reseller].[Not Applicable].[Not Applicable]' not found in cube 'Sales'
```

### /calculated

The `calculated` `/calc` [🦜️🔗][🦜️🔗] command is used to create new calculated members. Users need to provide necessary calculation logic information.

```bash theme={null}
/calc Create calculated member
Name: Profit Margin
Formula: (Sales Amount - Cost) / Sales Amount * 100
Description: Calculate product profit margin
```

### /formula

The `/formula` `/f` [🦜️🔗][🦜️🔗] command is used to edit the current calculated measure formula. Users need to provide necessary calculation logic information.

## Access Control Interface Commands

The following commands are available:

* `/role` Create role based on user description

## Virtual Cube Page Commands

### /formula

The `/formula` command is used to create suggestions for virtual cube calculation formulas. Users can enter commands and requirements in the copilot dialog box, and the copilot will generate corresponding calculation formulas for you.

```bash theme={null}
/formula Create a calculation for sales profit margin
```

## /modeler

`/modeler` or `/m` The data modeler can create shared dimensions and multidimensional datasets based on user prompts and table information, referencing business role examples. This command makes the data modeling process more automated and efficient, allowing users to focus on data analysis and decision-making.

<img src="https://mintcdn.com/xpertai/IL25qkwj-czMDTNd/public/img/copilot/command-modeler.png?fit=max&auto=format&n=IL25qkwj-czMDTNd&q=85&s=41ed386eddeb38cc93ab52f6fae20f04" alt="Modeler Command" width="3619" height="2616" data-path="public/img/copilot/command-modeler.png" />

[🦜️🔗]: ../../ai/copilot/#langchain
