Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

powerquery - Determine column on which invoke custom function

I am trying to invoke a function on an added column that will concatenate two columns. The catch is that I can't use the column name shorthand as I use dynamic parameters using strings to determine the column name.

Therefore the result is that I get a column as a List multiplied per row rather than the concatenated value for the specific row as intended

(func as text) =>

let
    Source = Excel.CurrentWorkbook(){[Name="DataTBL"]}[Content],

    \This is the string extraction process for the parameter
    funcTrig = Text.Start(func, 1),
    columnA =  "" & Text.BetweenDelimiters(func,"_","_") & "",
    columnB = "" & Text.AfterDelimiter(func,"_",1) & "",
    
    \converting the string to column data
    Convert2ColA = Table.Column(Source,columnA),
    Convert2ColB = Table.Column(Source,columnB),

    \function to concatanate column A value at a specific row with column B value at the same row.
    concat= StraightForward(Convert2ColA ,Convert2ColB) 
in
    concat

I have outlined with remarks the process and desired results, In the added picture I have pulled out the result of "Convert2ColA" what is the desired result will be 1999 in row one and so on.

enter image description here

question from:https://stackoverflow.com/questions/65921741/determine-column-on-which-invoke-custom-function

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...