Type.Facets

Type

Returns a record containing the facets (type constraints) of a type, such as precision and scale for decimal types.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Type.Facets(type as type) as record

Parameters

NameTypeRequiredDescription
typetypeYesThe type whose facets are returned.

Return Value

record — A record of facet values for the given type.

Remarks

Type.Facets returns a record describing the facets of a type: optional annotations that describe a type in more detail than its base kind, such as a text column's maximum length or a decimal column's precision. The record always has the same nine fields: NumericPrecisionBase, NumericPrecision, NumericScale, DateTimePrecision, MaxLength, IsVariableLength, NativeTypeName, NativeDefaultExpression, and NativeExpression. These match the facet columns that Table.Schema reports.

For types written as literals (like type number or type text), every field is null, meaning no facet has been set. Facets become meaningful on types that come from data sources. For example, a SQL Server nvarchar(50) column's type can carry MaxLength = 50, IsVariableLength = true, and NativeTypeName = "nvarchar".

Facets are informational only: M does not enforce them when values are created or converted.

Type.Facets is used in advanced introspection scenarios: custom connectors, schema comparison tools, or type annotation pipelines. The output of Type.Facets is a standard record that you can inspect with record field access or convert to a table with Record.ToTable. The complement function Type.ReplaceFacets creates a new type with modified facets.

Note that Type.Facets operates on a type value, not a data value. Use Value.Type(x) to obtain the type of a data value before passing it to Type.Facets.

Examples

Example 1: Facets of a plain number type — all null

Type.Facets(type number)
Output
Name
Value
1NumericPrecisionBasenull
2NumericPrecisionnull
3NumericScalenull
4DateTimePrecisionnull
5MaxLengthnull
6IsVariableLengthnull
7NativeTypeNamenull
8NativeDefaultExpressionnull
9NativeExpressionnull

Example 2: Facets of a nullable text type

Type.Facets(type nullable text)
Output
Name
Value
1NumericPrecisionBasenull
2NumericPrecisionnull
3NumericScalenull
4DateTimePrecisionnull
5MaxLengthnull
6IsVariableLengthnull
7NativeTypeNamenull
8NativeDefaultExpressionnull
9NativeExpressionnull

Example 3: Facets after applying precision and scale with Type.ReplaceFacets

let
    Constrained = Type.ReplaceFacets(type number, [NumericPrecision = 10, NumericScale = 2])
in
    Type.Facets(Constrained)
Applied Steps

The final output — Type.Facets returns the full facet record, with NumericPrecision 10, NumericScale 2, and every other facet null.

Name
Value
1NumericPrecisionBasenull
2NumericPrecision10
3NumericScale2
4DateTimePrecisionnull
5MaxLengthnull
6IsVariableLengthnull
7NativeTypeNamenull
8NativeDefaultExpressionnull
9NativeExpressionnull

Compatibility

✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks
Contributors
kyleamueller