Demystifying the underlying M code
The language in which the formulas and transformations you do in Power Query are written is called M. To master Power Query, you have to be familiar with the general syntax of the M language. At the core of all things done in Power Query, there are five value types:
- Primitive values: These are single entries such as numbers, text, logic, and
null
. Examples are2012
,"Michael Olafusi"
,false
, andnull
. - List values: We touched on these briefly in the introduction. They are an ordered collection of entries or values within curly brackets. An example is
{23, 45, 78, 95}
, which is a list of primitive values. However, a list can be a collection of a list, a record, a primitive value, or a combination of different types of values. Hence,{34, "Olafusi", {23, null, 10}, 25}
is a valid list. - Record values: These are a collection of key-value pairs within square brackets. An example is
[John = 18, Michael = 24, Mary = 29...