Value.Type

Value

Returns the type of a value.

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

Syntax

Value.Type(value as any) as type

Parameters

NameTypeRequiredDescription
valueanyYesThe value whose type to return.

Return Value

typeThe type of the given value (e.g., Number.Type, Text.Type, Logical.Type).

Remarks

Value.Type returns the M type of a value. This is useful for inspecting column values at runtime, building dynamic logic based on value types, or debugging type-related issues. Common return types include Number.Type, Text.Type, Logical.Type, Date.Type, and Table.Type.

Note that Value.Type returns an opaque type value. To display it meaningfully, you typically compare it using Value.Is or convert it to a description string with metadata functions.

Examples

Example 1: Check types of Sales column values

let
    FirstRow = Table.First(Sales),
    TypeName = (val) =>
        if Value.Is(val, type number) then "number"
        else if Value.Is(val, type text) then "text"
        else if Value.Is(val, type date) then "date"
        else "other"
in
    #table(
        {"Column", "Value", "Type"},
        {
            {"OrderID", Text.From(FirstRow[OrderID]), TypeName(FirstRow[OrderID])},
            {"CustomerName", FirstRow[CustomerName], TypeName(FirstRow[CustomerName])},
            {"UnitPrice", Text.From(FirstRow[UnitPrice]), TypeName(FirstRow[UnitPrice])},
            {"OrderDate", Text.From(FirstRow[OrderDate]), TypeName(FirstRow[OrderDate])}
        }
    )
Result
Column
Value
Type
1OrderID1number
2CustomerNameAlicetext
3UnitPrice25number
4OrderDate1/15/2024date

Compatibility

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