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

recordA record of facet values for the given type.

Remarks

Type.Facets returns a record describing the facets of a type — the additional constraints or properties associated with the type beyond its base kind. Facets are type-specific: for number types, relevant facets include Precision and Scale; for text types, MaxLength is a relevant facet.

For most primitive M types created with literal type expressions (like type number or type text), facets are present in the record but their values are null, meaning no constraint has been applied. Facets become meaningful when working with types derived from data sources — for example, a SQL Server column typed as DECIMAL(10, 2) will expose Precision = 10 and Scale = 2 through its type facets.

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)
Result
Name
Value
1Precisionnull
2Scalenull

Example 2: Facets of a nullable text type

Type.Facets(type nullable text)
Result
Name
Value
1MaxLengthnull

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

let
    Constrained = Type.ReplaceFacets(type number, [Precision = 10, Scale = 2])
in
    Type.Facets(Constrained)
Result
Name
Value
1Precision10
2Scale2

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks