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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Column as a parameter

Hello,

 

Here is my code : 

let
DisplayListWithoutDelimiters = (tablelist as table, column as text) =>
let
Hoho = tablelist[column]
//OneElement=Table.ReplaceValue(TableList, each [Column], each if List.Count(Text.Split([Column],";")) = 1 then Text.BeforeDelimiter([Column], "¤")&", "
//else if List.Count(Text.Split([Column],";")) = 2 then Text.BeforeDelimiter([Column], "¤")&", "&Text.AfterDelimiter([Column], "¤", {0, RelativePosition.FromEnd})&", "
//else if List.Count(Text.Split([Column],";")) > 2 then GetTextBetweenDelimiters([Column],"¤", ";", null)
//else null, Replacer.ReplaceText, {Column})

in 

Hoho

in 

DisplayListWithoutDelimiters

 

When I call my function : = DisplayListWithoutDelimiters(Table1, "Test")

I have an error message saying " column can't be find in the table "

It seems that the expression between the brackets can't be recognized as a parameter... 

column is a parameter and in this call it should be replaced by test so it should be Table1[test]

 

Thanks for you help !

 

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Because in the new blank query, you have no table column, you should copy the columns from another query, modify the M code like below:

let
    DisplayListWithoutDelimiters = (tablelist as table, column as text) as table => 
    let 
        Hoho = Table.SelectColumns(#"tablelist", column)
    in 
        Hoho
in 
    DisplayListWithoutDelimiters

1.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Because in the new blank query, you have no table column, you should copy the columns from another query, modify the M code like below:

let
    DisplayListWithoutDelimiters = (tablelist as table, column as text) as table => 
    let 
        Hoho = Table.SelectColumns(#"tablelist", column)
    in 
        Hoho
in 
    DisplayListWithoutDelimiters

1.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.