Create a computed column

Use a computed column to add a column of information to a table or worksheet typically using the information from one or more existing columns.

Computed columns are columns you create yourself in many cases using information that is already in the table with which you are working. For example, suppose you have a table that contains all the sales data for a chain of stores. This table has one column called Sales, which is the purchase price paid by the customer. It has another column called Cost, which is the cost of the item to the retailer. With a computed column, it is easy to create a third column called Margin that contains the difference between the sale price and the cost.

To create a computed column:

  1. In the New operation panel, click Compute.
    The Trillion-Row Spreadsheet displays the Compute panel.

  2. Complete the following fields:
    Name

    Enter the name that you want to assign to the computed column.

    This is the name the 1010data Insights Platform uses to interact with the column. It is also used when writing more advanced value expressions and queries.

    The column name must be unique. It may only contain alphanumeric characters or underscores and must begin with an alphabetic character (e.g., percent_total_sales). It may not contain any spaces or other special characters.

    This is a required field.
    Note: When entered, the Trillion-Row Spreadsheet (TRS) automatically removes special characters, replaces spaces with underscores, and displays a visual indication that a change was made.

    When TRS makes these changes, and if nothing has been entered in the Label field, the original text is automatically copied into the Label field.

    Label

    Enter the text that you want to appear at the top of the computed column when the table is displayed.

    This is the column heading that displays by default at the top of a column in the user interface.

    The column label may contain any combination of uppercase and lowercase letters, numbers, spaces, and special characters. If you want to have a multi-line column label, use the backtick character (`) to separate the lines (e.g., "Percentage of`Total Sales (%)").
    Note: On most standard United States keyboards, the backtick (`) character is immediately to the left of 1 key.

    While not required, this field is recommended.

  3. In the Expression Editor field, enter a value expression.
    The value expression may refer to one or more columns and may include standard arithmetic, relational, and logical operators as well as any of the Insights Platform's functions.
    Note: When entering a column in an expression, use the column name as opposed to the column label.

    For more information, see Writing Expressions in the 1010data Reference Manual. For more information about the Expression Editor, see Expression Editor.

    The Compute panel displays a preview of the first three rows of your expression. The preview displays only the column name(s) represented within the expression and the result of the expression.
  4. Optionally, to define the format of the computed column, complete the following:
    1. Click the More Options switch.
      The Trillion-Row Spreadsheet displays the formatting options in place of the Expression Editor.

    2. As necessary, select the appropriate option from the following drop-down lists:
      Display Format This drop-down list instructs the Trillion-Row Spreadsheet how to display the value in the computed column. For example, as a date, a number, as text, and so forth.
      Note: If set to Default, the format is determined by the data.
      Column Width This drop-down list specifies how many place values to hold in the column. In other words, the width of the column by the number of characters.
      You can select from 1 to 20 characters.
      Note: If set to Default, the width is determined by the data.
      Decimal Places This drop-down list sets how many numbers are displayed after the decimal point.
      You can select from 0 to 15 decimal places.
      Note: If set to Default, the number of decimal places is determined by the data, and may be different for each row.
  5. Click the Submit operation () icon.
    The Trillion-Row Spreadsheet creates the computed column.