Managing metadata
Simply put, metadata is data about data. In Power Query M, metadata can be associated with any value using the meta
keyword to define a metadata record. Metadata in and of itself does not do anything, nor does it change the behavior of a value in any way.
Consider the following query:
let
x = 10 meta [Type = "Whole number", OoM = 1],
y = 20 meta [Type = "Whole number", OoM = 1],
z = 30 meta [Type = "Whole number", OoM = 1]
in
x * y * z
This query still returns 6000
, just as before. However, the metadata associated with each value can be accessed and returned by using the Value.Metadata
function, as follows:
let
x = 10 meta [Type = "Whole Number", OoM = 1],
y = 20 meta [Type = "Whole Number", OoM = 1],
z = 30 meta [Type = "Whole Number", OoM = 1]
in
Value.Metadata(x)[Type]
This query returns Whole Number
.
Two additional metadata functions exist, Value...