Intermediate Power Query in Excel
Lyndsay Girard
Performance Analytics Consultant
let
Source = ""
in
Source
let
MyTable = Table.FromRecords({
[ID = 1, Name = "A", Result = 10],
[ID = 2, Name = "B", Result = 5]})
in
MyTable
Let expression with 1 step
let
MyTable = Table.FromRecords({
[ID = 1, Name = "A", Result = 10],
[ID = 2, Name = "B", Result = 5]}),
#"Sorted Rows" = Table.Sort(MyTable,{{"Result", Order.Ascending}})
in
#"Sorted Rows"
Let expression with two steps
let
MyTable = Table.FromRecords({
[ID = 1, Name = "A", Result = 10],
[ID = 2, Name = "B", Result = 5]}),
#"Sort" = Table.Sort(MyTable,{{"Result", Order.Ascending}}),
#"Lower" = Table.TransformColumns(#"Sort",{{"Name", Text.Lower, type text}})
in
#"Lower"
Let expression with three steps
Primitive
[ID = 1, Name = "A"]
Structured
List:
List = {1,2,3}
Record:
Record = [Column1=1,Column2=2]
Table:
Table = #table({"Column A","Column B"},
{{1,10},{2,20}})
Function:
Custom function syntax:
= (Variable as Data Type, Variable as Data Type) => (Output Expression)
Simple custom function example:
let
MyFunction = (x) => x + 1
in
MyFunction(10)
Intermediate Power Query in Excel