Value.Metadata

Value

Returns the metadata record associated with a value.

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

Syntax

Value.Metadata(value as any) as record

Parameters

NameTypeRequiredDescription
valueanyYesThe value whose metadata record is returned.

Return Value

recordThe metadata record attached to the value, or an empty record if none exists.

Remarks

In Power Query M, every value can carry an associated metadata record — an auxiliary record of key-value pairs attached to the value without affecting its underlying data or equality. Metadata is attached using the meta keyword: value meta [Key = "value"].

Value.Metadata retrieves this metadata record. If the value has no metadata, an empty record ([]) is returned — never null.

Key behaviors of metadata in M:

- Transparent to equality: 1 meta [Tag = "x"] is equal to 1. Metadata does not affect the = operator, Value.Equals, or type checks. - Lost on operations: most M operations discard metadata from their inputs. For example, (1 meta [Tag = "x"]) + 1 returns 2 with no metadata. Metadata must be explicitly re-attached if needed after transformations. - Used by the engine: Power Query uses metadata internally to carry display format strings, column descriptions, and data source information. You can read this engine metadata with Value.Metadata.

The companion functions are Value.ReplaceMetadata (to set or replace metadata) and Value.RemoveMetadata (to strip it). The meta keyword expression v meta r is equivalent to Value.ReplaceMetadata(v, r).

Examples

Example 1: Retrieve metadata attached with the meta keyword

Value.Metadata(1 meta [Source = "Sales", Verified = true])
Result
Name
Value
1SourceSales
2Verifiedtrue

Example 2: A value without metadata returns an empty record

Result
Name
Value

Example 3: Access a specific field from the metadata record

let
    Annotated = "hello" meta [Language = "en", Source = "Config"],
    Meta = Value.Metadata(Annotated)
in
    Meta[Language]
Applied Steps

The final output — accesses the Language field from the metadata record, returning "en".

Result
1en

Compatibility

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