向 Power Query 条件语句添加多个步骤
add Multiple steps to a Power Query conditional statement
我有一个有效的单步条件语句
BlanksToNull = Table.ReplaceValue(#"Trimmed Text","",null,Replacer.ReplaceValue,Table.ColumnNames(#"Trimmed Text")),
newMergedHeader = Excel.CurrentWorkbook(){[Name="newheader"]}[Content]{0}[Column1],
#"Merged Columns" =
if newMergedHeader <> null then
Table.CombineColumns(BlanksToNull,mergeHeaders[List Of Headers For Concatenation], each Combiner.CombineTextByDelimiter("|", QuoteStyle.None)(List.RemoveNulls(_)),"Merged"),
else
BlanksToNull
in
if newMergedHeader <> null then
#"Merged Columns"
else
BlanksToNull
但是如果newMergedHeader <> null
我也想加上这个
#"Renamed Columns" = Table.RenameColumns(#"Merged Columns",{{"Merged",newMergedHeader}})
有没有办法将它添加到现有的 If 语句中?还是我需要再写一个 If 语句?
我试过了
#"Merged Columns" =
if newMergedHeader <> null then
Table.CombineColumns(BlanksToNull,mergeHeaders[List Of Headers For Concatenation], each Combiner.CombineTextByDelimiter("|", QuoteStyle.None)(List.RemoveNulls(_)),"Merged"),
#"Renamed Columns" = Table.RenameColumns(#"Merged Columns",{{"Merged",newMergedHeader}})
else
BlanksToNull
但这不起作用
谢谢
眼球,看起来你多了一个逗号 Merged"),
如果你删除它并合并你的陈述,我认为你可以做到
#"Merged Columns" =
if newMergedHeader <> null then
Table.RenameColumns(
Table.CombineColumns(BlanksToNull,mergeHeaders[List Of Headers For Concatenation], each Combiner.CombineTextByDelimiter("|", QuoteStyle.None)(List.RemoveNulls(_)),"Merged")
,{{"Merged",newMergedHeader}})
else BlanksToNull
但我不清楚为什么你需要 in 之后的整个尾端而不是仅仅替换
in
if newMergedHeader <> null then
#"Merged Columns"
else
BlanksToNull
与
in #"Merged Columns"
因为你已经完成了所有的工作
我有一个有效的单步条件语句
BlanksToNull = Table.ReplaceValue(#"Trimmed Text","",null,Replacer.ReplaceValue,Table.ColumnNames(#"Trimmed Text")),
newMergedHeader = Excel.CurrentWorkbook(){[Name="newheader"]}[Content]{0}[Column1],
#"Merged Columns" =
if newMergedHeader <> null then
Table.CombineColumns(BlanksToNull,mergeHeaders[List Of Headers For Concatenation], each Combiner.CombineTextByDelimiter("|", QuoteStyle.None)(List.RemoveNulls(_)),"Merged"),
else
BlanksToNull
in
if newMergedHeader <> null then
#"Merged Columns"
else
BlanksToNull
但是如果newMergedHeader <> null
我也想加上这个
#"Renamed Columns" = Table.RenameColumns(#"Merged Columns",{{"Merged",newMergedHeader}})
有没有办法将它添加到现有的 If 语句中?还是我需要再写一个 If 语句?
我试过了
#"Merged Columns" =
if newMergedHeader <> null then
Table.CombineColumns(BlanksToNull,mergeHeaders[List Of Headers For Concatenation], each Combiner.CombineTextByDelimiter("|", QuoteStyle.None)(List.RemoveNulls(_)),"Merged"),
#"Renamed Columns" = Table.RenameColumns(#"Merged Columns",{{"Merged",newMergedHeader}})
else
BlanksToNull
但这不起作用
谢谢
眼球,看起来你多了一个逗号 Merged"),
如果你删除它并合并你的陈述,我认为你可以做到
#"Merged Columns" =
if newMergedHeader <> null then
Table.RenameColumns(
Table.CombineColumns(BlanksToNull,mergeHeaders[List Of Headers For Concatenation], each Combiner.CombineTextByDelimiter("|", QuoteStyle.None)(List.RemoveNulls(_)),"Merged")
,{{"Merged",newMergedHeader}})
else BlanksToNull
但我不清楚为什么你需要 in 之后的整个尾端而不是仅仅替换
in
if newMergedHeader <> null then
#"Merged Columns"
else
BlanksToNull
与
in #"Merged Columns"
因为你已经完成了所有的工作