Value.Is
ValueChecks whether a value is compatible with a specified type.
Syntax
Value.Is(value as any, type as type) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | The value to check. |
type | type | Yes | The type to check against (e.g., type number, type text, type date). |
Return Value
logical — True if the value is compatible with the specified type, otherwise false.
Remarks
Value.Is returns true if a value is compatible with the specified type, and false otherwise. This is useful for type-checking before performing type-specific operations, or for building conditional logic that handles mixed-type columns.
Common type checks include type number, type text, type logical, type date, type record, type list, and type table.
Examples
Example 1: Check if Sales OrderID values are numbers
let
FirstRow = Table.First(Sales),
CheckOrderID = Value.Is(FirstRow[OrderID], type number),
CheckName = Value.Is(FirstRow[CustomerName], type number)
in
#table(
{"Field", "Value", "IsNumber"},
{
{"OrderID", Text.From(FirstRow[OrderID]), Text.From(CheckOrderID)},
{"CustomerName", FirstRow[CustomerName], Text.From(CheckName)}
}
)Result
Field | Value | IsNumber | |
|---|---|---|---|
| 1 | OrderID | 1 | true |
| 2 | CustomerName | Alice | false |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks