Forum Discussion
Pass Parameter as column name in custom column calculation
- Anonymous5 years ago
u could, peraphs use this sheme:
a function like this:
let newTab = (Col1,Col2)=>Table.AddColumn(Table, "newColumnName", each Record.Field(_, Col1)-Record.Field(_, Col2)) in newTabwhich when invoked using the names of two columns of you table:
gives:
- Anonymous5 years ago
I think i figured it out. I modified your Function to be a simple addcolumn step:
Table.AddColumn(PreviousStep, "Delta", each Record.Field(_, #"Scenario 1")-Record.Field(_, #"Scenario 2"))
Where Scenario 1 and Scenario 2 are the query parameter names. Seems to work!
u could, peraphs use this sheme:
a function like this:
let
newTab = (Col1,Col2)=>Table.AddColumn(Table, "newColumnName", each Record.Field(_, Col1)-Record.Field(_, Col2))
in
newTab
which when invoked using the names of two columns of you table:
gives:
I think i figured it out. I modified your Function to be a simple addcolumn step:
Table.AddColumn(PreviousStep, "Delta", each Record.Field(_, #"Scenario 1")-Record.Field(_, #"Scenario 2"))
Where Scenario 1 and Scenario 2 are the query parameter names. Seems to work!