Skip to main content

Dimension

Definition

Dimension syntax defines the dimension of a data model. Dimension represents a column in a table or a calculation.

Parameters

Parameter nameDescription
labelSpecifies how the dimension will appear in the Ready-to-explore Dataset
typeSpecifies the data type you want to apply to the dimension (currently Holistics only support text/number/date/datetime/truefalse)
descriptionAdd dimension description
hiddenHides dimension from the Exploration interface of Dataset and Report
definitionDetermines how the dimension will be defined or calculated based on SQL queries. Learn more about the definition parameter below. 👇

SQL Definition of Dimension

The concept of definition: @sql {{ }};; refers to the way you specify how each dimension’s values should be retrieved or calculated based on SQL queries.

References: There are two ways to reference columns or dimensions within the SQL definition:

  • @sql {{ #SOURCE.column_name }};; : This references a column in the table connected to the current model.
  • @sql {{ dimension_name }};; : This references another dimension defined within the same model.

Default Behavior: If the SQL definition for a dimension is not explicitly provided, Holistics assumes that there is a column in the underlying table with the same name as the dimension. This is useful for cases where the dimension's name matches a column name, and you want to use that column as the dimension's source.

Examples

Model orders {
type: 'table'
label: "Orders"
table_name: 'ecommerce.orders'
data_source_name: 'mydemodb'
description: "This is the AML Orders Model"

dimension status {
label: 'Status'
type: 'text'
//to reference the "status" column in the source table
definition: @sql {{ #SOURCE.status }};;
}

dimension created_at {
label: 'Created At'
type: 'datetime'
}

dimension created_at_year {
label: 'Created At Year'
type: 'number'
//to calculate the year from the "created_at" dimension
definition: @sql extract(year from{{ created_at }});;
}
}

Let us know what you think about this document :)