Concepts → Materialized View Formula Column

About a materialized view formula column

A materialized view formula column contains a formula expression that returns a scalar value of a specific data type and functions as either a measure or a dimension. During a load job, the Loader Service processes the formula expression and persists the returned values to shared storage. To define the formula expression of a formula column, you use the Formula Builder.

Properties of a materialized view formula column

Following are the properties of a materialized view formula column:

PropertyControlDescription
Nametext boxThe column’s name; used in the fully qualified name of the column
Labeltext boxA user friendly name
Typeread onlyThe data type of the column. The data type of a column in a materialized view is determined by the formula result.
Functiondrop down listSelect the Incorta Function of the column
Column Formulatext boxShows the column formula expression. Select to open the Formula Builder to add or edit the formula expression.
Show in AnalyzercheckboxSelect this property to show the column as selectable in the Data Panel
Data LineagelinkAvailable starting with 2023.7.0.
Select the Lineage link to open the Data Lineage Viewer v2 that displays a diagram with the entities referenced in the respective column (upstream lineage) and entities where the respective column is referenced (downstream lineage).

Type inference

Based on the output of the formula expression, the Table Editor will automatically infer the data type of a formula column. You can modify the formula expression to explicitly cast the data type of the return value. For example, you can use a built-in function such as int() to specify that the formula expression returns an integer value.

Note

Some databases such as Oracle and SQL Server will store a time component for a column of the type DATE. For this reason, Incorta will infer a Timestamp data type for a database DATE column.

Function

A materialized view formula column can be used as a dimension or a measure.

Function: Dimension

A dimension categorizes, describes, or groups data. Examples of a dimension column are State, Year, or City. Dimension columns do not require unique values.

A dimension column has an associated behavior in the Analyzer. When you double-click a dimension column in the Data panel, the Analyzer automatically adds the column to the Grouping Dimension tray in the Insight panel.

Function: Measure

A measure is a measurement of data. Examples of a measure column are Revenue, Quantity, and Cost.

A measure column has an associated behavior in the Analyzer. When you double-click a measure column in the Data panel, the Analyzer automatically adds the column to the Measure tray in the Insight panel.

Formula expression for a materialized view formula column

A formula expression returns a scalar value or array of values. These values are of a specific type. A formula expression can consist of built-in functions, date system variables, and referenceable columns.

Available built-in functions

There are several groups of built-in functions available for use in a formula expression for a materialized view formula column. All functions return a scalar value:

Function TypeDescription
BooleanEvaluates to True or False
Conditional StatementReturns a value based on the evaluation of a parameter
ConversionConverts the Incorta Data Type of a parameter. In addition, functions that manipulate Timestamp and Date values for different return values.
MiscellaneousAssorted uses
ArithmeticTakes one or more values and return a single value
DateManipulates Timestamp and Date values
StringReturns string values or return values based on string parameters

Date system variables

Only date system variables are supported for use in a materialized view formula column.

Important

If you reference the $user variable or a session variable in a materialized view formula column, you will encounter either a validation or load error.

Referenceable columns

A referenceable column has a fully qualified name. A referenceable column can be a data-backed column or formula column. A materialized view formula column is evaluated during a load job.

A materialized view will not inherit joins from its queried source columns. A materialized view formula column’s possible reference options are bound by the child join relationships of the materialized view. If the materialized view is not the child in any join relationship, the only columns that can be used in a materialized view formula column are the materialized view’s existing columns.

Following are the possible types of referenceable columns in a materialized view formula column:

Table or View TypeColumn TypeReferenceableNote
AliasData-backed columnYes
AliasFormula columnYes
Business Schema ViewData-backed columnNo
Business Schema ViewFormula columnNo
Incorta Analyzer TableData-backed columnYes
Incorta Analyzer TableFormula columnYes
Incorta SQL TableData-backed columnYesThe Incorta SQL Table is an Incorta Labs feature and is enabled in the CMC.
Incorta Analyzer ViewData-backed columnNo
Incorta Analyzer ViewFormula columnNo
Materialized ViewData-backed columnYes
Materialized ViewFormula columnYes
Physical Schema TableData-backed columnYes
Physical Schema TableFormula columnYes
Note

A load job will reveal an error for a non-validated formula expression for a physical schema table formula column.

Warning

A materialized view formula column cannot reference an Incorta Analyzer table column or Incorta SQL table column that references a business schema view.

When using system variables in the physical schema, the system variable’s value is only calculated on a schema load. Take this into account when using them in any aspect of your physical schema.