# Adding a Custom Column

> Add new columns to existing tables in both ElastiCube and live models. Useful for combining data from different existing columns, and cleansing and preparing data.

*Source: https://docs.sisense.com/main/SisenseLinux/adding-a-custom-column.htm*

---

Last updated: June 11, 2026

|  |  |
| --- | --- |
| [Tier](https://www.sisense.com/pricing/#pricing) | [Deployment](https://docs.sisense.com/main/SisenseLinux/introduction-to-sisense-cloud-managed-services.md#ComparisonofManagedCloudandSelfHosted) |
| Launch     Grow    Enterprise | Cloud     On-Prem |

Sisense makes it easy for you to add new columns to existing tables in both ElastiCube and live models. This can be
useful if you need to combine data from different existing columns, and when you need to cleanse and prepare data.

Watch this video about custom tables and columns:

The new columns also provide Designers with additional fields to use as-is, or as a basis for even more advanced
calculations in their widgets. You can use SQL to customize the values contained within the custom columns.

There are some limitations to this feature. For more information, see below.

**To add a new column:**

1. In the Navigation Pane, select ![8 6v7menu](https://docs.sisense.com/main/Resources/Images/8-6v7menu2.png) and
   click **Add Custom Column**.

   ![Add custom column](https://docs.sisense.com/main/Resources/Images/add-custom-column-2.png)

   Or

   In the ElastiCube model, select the table and click ![8 6v7tablemenu](https://docs.sisense.com/main/Resources/Images/8-6v7tablemenu.png) and **Add Custom Column**.

   ![Add custom column](https://docs.sisense.com/main/Resources/Images/add-custom-column-3.png)

   The new column will be added to the table, and an SQL Editor is displayed where you define your custom SQL
   expression.

   ![Add custom colum sql](https://docs.sisense.com/main/Resources/Images/add-custom-colum-sql.png)

   **Note:**

   For live connections, only "Fields" appears in the left-hand panel.
2. In the **New Custom Column field**, enter the name of your custom column and click ![8 6checkpoint](https://docs.sisense.com/main/Resources/Images/8-6checkpoint.png).

   Note:

   You should not name a custom column using the same name as an existing (original) column in the model.

   For example, if the there is original column with name ‘column1’, do not rename ‘column1’ to ‘column1 - original’ and then rename a custom column to be ‘column1’.
3. In the SQL Editor, enter your custom expression.
4. Click ![Save](https://docs.sisense.com/main/Resources/Images/Save.png) to add your column to the
   table.

## Custom Field Use Cases

Here are some typical scenarios for creating custom fields.

**Note:**

In live models, the SQL syntax is derived from the data source syntax. This also means that the column expression
works on top of the actual source table. So, for instance, if a column was renamed in the live model, the new name
cannot be used in the column expression. Instead, use the original column name from the data source.

### Example: Snowflake JSON field Extraction

**Note:**

There are many ways to extract JSON fields from Snowflake. The following is one method.

If JSON\_DATA is the column, extract JSON fields from it using the following Snowflake syntax:

`JSON_DATA:childProp:childProp:...:targetProp::dataType`

For instance, to extract the 'title' property from the JSON field as a string, use the following custom column
expression:

`JSON_DATA:title::string`

In the following example, the expression goes down two nested levels to extract the full name from the data source as
a string:

`JSON_DATA:datasource:fullname::string`

For more information, see the [Snowflake documentation](https://docs.snowflake.com/en/user-guide/querying-semistructured.html).

#### Row Level Calculations

Calculate revenue from your sales data.

`Gross Revenue = (Unit Price * QuantitySold)`
  
`Net Revenue = (Unit Price * QuantitySold) - (Unit Cost * QuantityPurchased)`

#### Time Difference Calculations

Work out the arrival time based on due and actual arrival dates.

`daydiff (DueDate,ReceivedAt)`

#### Relative Difference Calculations

Figure out the relative difference between your price and competitor price.

`((CompetitorPrice-MyPrice)/((CompetitorPrice+MyPrice)/2))`

#### Buckets

Create data buckets according to your required business break points.

`CASE`
  
`WHEN [PriceVsCompetitor%] &lt; -0.05 THEN '-5%'`
  
`WHEN [PriceVsCompetitor%] &gt;= -0.05 AND [PriceVsAvgCompetitor%] &lt;= 0.05 THEN '-5%/+5%'`
  
`WHEN [PriceVsCompetitor%] &gt; 0.05 THEN '+5%'`
  
`end`

#### Attributes

Create attributes to translate data talk to more coherent categories.

`CASE`
  
`WHEN Region = 1 THEN 'USA'`
  
`WHEN Region = 2 THEN 'EUR'`
  
`WHEN Region = 3 THEN 'ASIA'`
  
`end`

#### Date Conversions

Convert dates into a numeric representation.

`getyear(Date)*10000+getmonth(Date)*100+getday(Date) AS DateNum`

Convert text into dates.

`createdate( toint('20'+RIGHT([Timesheet_Date],2)),`
  
`toint(LEFT(Timesheet_Date,2)),`
  
`toint(StrBetween(Timesheet_Date,'/','/')))`

## Date Period Comparisons Over Time

Create month to date and year to date calculations.
  
[Click
here](https://sisense.wixanswers.com/app/kb/article/a19ceb5b-19c1-44f8-b949-ac41f7dbb3fd/en) for a support article with more information.

### Surrogate Keys

`EmployeeID+tostring([DateNum])+tostring(CustomerID)+tostring([Project_ID])`

### Importing from Another Table

See [Adding Custom Tables](https://docs.sisense.com/main/SisenseLinux/adding-a-custom-table.md) to learn more.

## Limitations

- SELECT statements are not supported
- Live Custom Columns can only be applied to base tables. This feature cannot be applied to live table queries.
- Live Custom Columns cannot be based on other live Custom Columns.
- After you change the data type of a Live custom column, any dashboard filters that use this column need to be
  recreated.
- Do not rename a custom column using the name of one of the original columns.
