Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Help with Custom Function

Hi, 
Power query learner here. I am trying to create a custom function. I have a table which after initial processing still contains column headers that start with the text "Column". I wanted to invoke this function on the last step so then I can get rid of all these columns that start with "Column". 

I used below function but what it is doing is returning a table with all columns that start with "Column" text rather than removing it. Any idea how to fix this? 

 

 

(InputQueryTable as table) =>
let
Source = #"InputQueryTable",
#"Column Names" = Table.ColumnNames(Source),
#"Columns Containing String" = List.FindText(#"Column Names", "Column"),
//#"Columns Containing String" = List.Contains( #"Column Names", "", Text.StartsWith( "Column") ),
//#"Columns Containing String" = List.FindText(#"Column Names", Text.StartsWith( "Column") ),
#"List Difference" = List.Difference( #"Column Names", #"Columns Containing String"),
#"Removed Columns" = Table.RemoveColumns(Source, #"List Difference")
in
#"Removed Columns"

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, 
found the answer myself. Updated code below. 

sum(Earned Hours )  / Sum(CurrentEst)

(InputQueryTable as table) =>
let
Source = #"InputQueryTable",
#"Column Names" = Table.ColumnNames(Source),

#"Columns Containing String" = List.FindText(#"Column Names", "Column"),

#"Removed Columns" = Table.RemoveColumns(Source, #"Columns Containing String")
in
#"Removed Columns"

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi, 
found the answer myself. Updated code below. 

sum(Earned Hours )  / Sum(CurrentEst)

(InputQueryTable as table) =>
let
Source = #"InputQueryTable",
#"Column Names" = Table.ColumnNames(Source),

#"Columns Containing String" = List.FindText(#"Column Names", "Column"),

#"Removed Columns" = Table.RemoveColumns(Source, #"Columns Containing String")
in
#"Removed Columns"

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors