Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Dear all,
I would need your support to solve this basic problem.
I have this Custom Function:
(
Input_Table as table,
ColumnToRemove1 as text,
ColumnToRemove2 as text,
ColumnToRemove3 as text,
InputColumn1 as text,
InputColumn2 as text,
InputColumn3 as text,
InputColumn4 as text
) =>
let
SourceNoNull = Table.ReplaceValue(
Input_Table,
null,
(x)=>x,
(x,y,z)=>
if x = null
then ""
else x,
Table.ColumnNames(Input_Table)),
RemovedColumn = Table.RemoveColumns(
SourceNoNull,{
ColumnToRemove1,
ColumnToRemove2,
ColumnToRemove3
}),
Helper_1 = Table.AddColumn(RemovedColumn, "Helper_1", each Text.Combine({InputColumn1, InputColumn2}, ""), type text)
in Helper_1
and this is Invoked in this way:
let
Source = Excel.CurrentWorkbook(){[Name="Connection_Type_DISTRIBUTION"]}[Content],
ChangeDistribution = Distribution_Manipulation(
Source,
"Y3",
"MKT_Distribution",
"Split_per_Step",
"Region",
"Project_Step",
"Function_Description",
"Distribution"
)
in
ChangeDistribution
The part withAddColumn does not do what I want.
Here what I have when I inoke the function:
However I want to have this:
Probably I am doing something not correct when I am passing the parameters to the function.
Thanks for your support
Solved! Go to Solution.
Hi @Mic1979
Try with this
(
Input_Table as table,
ColumnToRemove1 as text,
ColumnToRemove2 as text,
ColumnToRemove3 as text,
InputColumn1 as text,
InputColumn2 as text,
InputColumn3 as text,
InputColumn4 as text
) =>
let
// Replace null values with empty strings
SourceNoNull = Table.ReplaceValue(
Input_Table,
null,
"",
Replacer.ReplaceValue,
Table.ColumnNames(Input_Table)
),
// Remove specified columns
RemovedColumn = Table.RemoveColumns(
SourceNoNull,
{ColumnToRemove1, ColumnToRemove2, ColumnToRemove3}
),
// Combine values from InputColumn1 and InputColumn2 into a new column "Helper_1"
Helper_1 = Table.AddColumn(RemovedColumn, "Helper_1", each Text.Combine({Record.Field(_, InputColumn1), Record.Field(_, InputColumn2)}, ""), type text)
in
Helper_1
Many thanks.
based on what you said, I tried this other function:
(
Input_Table as table,
SeriesColumn as text,
Port12Column as text,
Port3Column as text
) =>
let
RULE_1_1 = Table.ReplaceValue (
Input_Table,
each Port3Column,
each if SeriesColumn = "2 way Angle Body Valve" and
Port12Column = "1st and 2nd Ways Threaded" and
Port3Column = "NOT APPLICABLE"
then "NOT APPLICABLE"
else Port3Column,
Replacer.ReplaceText,
Table.ColumnNames(Input_Table) = "Port3Column"
)
in RULE_1_1
It gives an error message, not sure what is notgoing fine here.
Any suggestion?
Thanks.
This is the error message I got:
I think I still did not get properly how to pass parameters 😔.
Thanks.
Hi @Mic1979
Try with this
(
Input_Table as table,
ColumnToRemove1 as text,
ColumnToRemove2 as text,
ColumnToRemove3 as text,
InputColumn1 as text,
InputColumn2 as text,
InputColumn3 as text,
InputColumn4 as text
) =>
let
// Replace null values with empty strings
SourceNoNull = Table.ReplaceValue(
Input_Table,
null,
"",
Replacer.ReplaceValue,
Table.ColumnNames(Input_Table)
),
// Remove specified columns
RemovedColumn = Table.RemoveColumns(
SourceNoNull,
{ColumnToRemove1, ColumnToRemove2, ColumnToRemove3}
),
// Combine values from InputColumn1 and InputColumn2 into a new column "Helper_1"
Helper_1 = Table.AddColumn(RemovedColumn, "Helper_1", each Text.Combine({Record.Field(_, InputColumn1), Record.Field(_, InputColumn2)}, ""), type text)
in
Helper_1
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 17 | |
| 9 | |
| 9 | |
| 7 | |
| 7 |