Column

Understanding Columns in RestBI

A Column represents a field within a table or view in the underlying database. Columns are the individual data points that are queried, filtered, and manipulated when interacting with the data model. Each column is associated with a specific table and has properties that define its behavior and how it should be interpreted.

Overview & Usage

Columns are the building blocks of queries in the model. When constructing a query, users will select columns based on their name and can apply filters, groupings, or aggregations depending on the column's type and dataType.

Each column's role within the model, whether as a measure or dimension, influences how it can be used in analysis and reporting. Generally, measures like sales, number of employees, or counts are aggregated while dimensions such as Store Region or Customer Name serve as grouping variables.

Example

Here is an example of how a Column might be defined within a table:

const salesOrderIDColumn: Column = {
    id: '1',
    dbName: 'SalesOrderID',              // The actual column name in the database
    name: 'Sales Order ID',               // The display name used within the model
    dataType: ColumnDataType.NUMBER,      // The data type of the column
    type: ColumnType.DIMENSION            // The column type, in this case, a dimension
};

const totalDueColumn: Column = {
    id: '2',
    dbName: 'TotalDue',                   // The actual column name in the database
    name: 'Total Due',                    // The display name used within the model
    dataType: ColumnDataType.NUMBER,      // The data type of the column
    type: ColumnType.MEASURE,             // The column type, in this case, a measure
    aggregationType: 'SUM'                // The default aggregation for this measure
};

Column Reference

PropertyDescription

id

A unique identifier for the column.

dbName

The actual name of the column in the database.

name

The user-friendly name for the column, used within the model for display purposes.

alias

An optional alias used in SQL queries to reference this column.

type

The type of the column, determining whether it is a measure or dimension (ColumnType.MEASURE or ColumnType.DIMENSION).

dataType

The data type of the column (STRING, NUMBER, DATE, etc.), represented by the ColumnDataType enum.

aggregationType

The type of aggregation to apply to the column when used in queries (e.g., SUM, AVG, etc.).

See Also

  • Tables - Understand how Tables house Columns representing fields in your database.

  • Joins - Learn how to link Columns from different Tables using Joins.

  • Formulas - Create dynamic Columns by applying calculations and logic to existing data.

  • Query Filters - Filter your data by applying conditions to Columns in your queries.

Last updated