我正在超级查询中创建一个新查询,并打开了高级编辑器来调整其中一个步骤。该查询工作正常,但所有步骤已从右侧的“应用步骤”菜单中消失,并合并为一个步骤。
我如何再次将它们分为几个小步骤(这更容易理解和解决问题)?
每次使用高级编辑器都会发生这种情况吗?
下面的我的代码。我能以某种方式在右侧的“应用步骤”菜单中将每一行显示为单独的步骤吗?
let
Source = Excel.CurrentWorkbook(){[Name="FlagsAllClients"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Portfolio Manager", type text}, {"Client ID", type text}, {"Client Name", type text}, {"KE", type text}, {"Portfolio ID", type text}, {"Days Out", Int64.Type}, {"Risk Category", type text}, {"Risk", type text}, {"Tracking Error", type text}, {"Concentration", type text}, {"Sector", type text}, {"Buy-List", type text}, {"Max Hld Wt", type text}, {"Anom. Hldgs", type text}, {"Concentration Issuer", type text}, {"Portfolio Value", type number}, {"Date", type datetime}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type",{"Portfolio Manager"},BD_Office,{"BG"},"BD_Office",JoinKind.LeftOuter),
#"Expanded BD_Office" = Table.ExpandTableColumn(#"Merged Queries", "BD_Office", {"Team"}, {"BD_Office.Team"}),
#"Merged Queries1" = Table.NestedJoin(#"Expanded BD_Office",{"Client ID"},FlagsT,{"Client ID"},"FlagsT",JoinKind.LeftOuter),
#"Expanded FlagsT" = Table.ExpandTableColumn(#"Merged Queries1", "FlagsT", {"Risk", "Sector", "Buy-List", "Max Hld Wt"}, {"FlagsT.Risk", "FlagsT.Sector", "FlagsT.Buy-List", "FlagsT.Max Hld Wt"}),
#"Merged Queries2" = Table.NestedJoin(#"Expanded FlagsT",{"Client ID"},FlagsT_1,{"Client ID"},"FlagsT_1",JoinKind.LeftOuter),
#"Expanded FlagsT_1" = Table.ExpandTableColumn(#"Merged Queries2", "FlagsT_1", {"Risk", "Sector", "Buy-List", "Max Hld Wt"}, {"FlagsT_1.Risk", "FlagsT_1.Sector", "FlagsT_1.Buy-List", "FlagsT_1.Max Hld Wt"}),
#"Removed Other Columns" = Table.SelectColumns(#"Expanded FlagsT_1",{"Portfolio Manager", "Client ID", "Client Name", "KE", "Portfolio Value", "BD_Office.Team", "FlagsT.Risk", "FlagsT.Sector", "FlagsT.Buy-List", "FlagsT.Max Hld Wt", "FlagsT_1.Risk", "FlagsT_1.Sector", "FlagsT_1.Buy-List", "FlagsT_1.Max Hld Wt"}),
#"Reordered Columns" = Table.ReorderColumns(#"Removed Other Columns",{"BD_Office.Team", "Portfolio Manager", "Client ID", "Client Name", "KE", "Portfolio Value", "FlagsT.Risk", "FlagsT.Sector", "FlagsT.Buy-List", "FlagsT.Max Hld Wt", "FlagsT_1.Risk", "FlagsT_1.Sector", "FlagsT_1.Buy-List", "FlagsT_1.Max Hld Wt"}),
#"Replaced Value" = Table.ReplaceValue(#"Reordered Columns","X","1",Replacer.ReplaceValue,{"FlagsT.Risk","FlagsT.Sector","FlagsT.Buy-List","FlagsT.Max Hld Wt","FlagsT_1.Risk","FlagsT_1.Sector","FlagsT_1.Buy-List","FlagsT_1.Max Hld Wt"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","!","0",Replacer.ReplaceText,{"FlagsT.Risk","FlagsT.Sector","FlagsT.Buy-List","FlagsT.Max Hld Wt","FlagsT_1.Risk","FlagsT_1.Sector","FlagsT_1.Buy-List","FlagsT_1.Max Hld Wt"}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value","2","0",Replacer.ReplaceText,{"FlagsT.Risk","FlagsT.Sector","FlagsT.Buy-List","FlagsT.Max Hld Wt","FlagsT_1.Risk","FlagsT_1.Sector","FlagsT_1.Buy-List","FlagsT_1.Max Hld Wt"})
in
#"Replaced Value1"
答案 0 :(得分:1)
我认为这里的问题是,您在最后一行中的in
参考是指M代码中倒数第二个步骤。如果您将in #"Replaced Value1"
更改为in #"Replaced Value2"
,我怀疑它的行为会更像您期望的那样。
您可能还希望#"Replaced Value2"
行引用#"Replaced Value1"
,而不是第二个引用#"Replaced Value"
。
答案 1 :(得分:1)
基本上,我无法引用电源编辑器中的上一步。 https://social.technet.microsoft.com/Forums/en-US/bfe0e2e4-16e0-4d76-b3b9-27a43ce27866/excel-power-query-advanced-editor-breaking-code-into-steps?forum=powerquery
上发布了有助于我了解自己在做什么错的说明。电源查询代码通常是这样编写的:
let
step1 = blah blah,
step2 = blah(step1 blah),
step3 = blah(step2, blah)
in
step3
因此,如果您添加一个新步骤,请记住后续步骤必须引用它, 而“输入”之后最后一行的步骤应该是最后一步。你可能忘了改变 “ in”之后的步骤名称