Excel 中级 Power Query
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
包含 1 步的 Let 表达式
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"
包含 2 步的 Let 表达式
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"
包含 3 步的 Let 表达式
原始类型
[ID = 1, Name = "A"]
结构化类型
列表:
List = {1,2,3}
记录:
Record = [Column1=1,Column2=2]
表:
Table = #table({"Column A","Column B"},
{{1,10},{2,20}})
函数:
自定义函数语法:
= (Variable as Data Type, Variable as Data Type) => (Output Expression)
简单的自定义函数示例:
let
MyFunction = (x) => x + 1
in
MyFunction(10)


Excel 中级 Power Query