Basic Points in Power Query M language
There are the following points that one will note in the Power Query M language:
Point 1: M is a case-sensitive language. The M language is the case-sensitive language. For example, the function Table.DemoteHeaders cannot be used as Table.demoteheaders.
Point 2: Advanced Editor In the Home menu we can open the Advanced Editor to open the dialog box to write the code in it.
Point 3: Steps in Code The steps in Power Query are separated by commas (,), and please note at the last step the comma is not there. In the next step, the output of the previous step is referenced by its name. If the step name has space then it is referenced in the next step using the #“Step name”.
Example:
Power Query M
let MyTable = Table.FromRecords( { [CustomerID = 1, Name = "Ashish", Marks = 568], [CustomerID = 2, Name = "Katrina", Marks = 855], [CustomerID = 3, Name = "Alia", Marks = 380], [CustomerID = 4, Name = "Vicky", Marks = 458], [CustomerID = 5, Name = "Mohini", Marks = 278], [CustomerID = 6, Name = "Meenakshi", Marks = 289], [CustomerID = 7, Name = "Esha", Marks = 875], [CustomerID = 8, Name = "Anjali", Marks = 380] } ), #"Return Output" = Table.First(MyTable) in #"Return Output"
Point 4: Syntax Structure M scripts follow a structure with let and in.
- let: Used to define variables and intermediate results.
- in: Specifies the final expression that gives the output.