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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Function working with String but not with Column

I got this line

 

Additional_Info = Table.AddColumn(Location_Office, "Additional_Info", each getRemaining("test   test", Text.Split(Text.Combine({[Column2], [Column3], [Column4], [Column5]}, "#(lf)"), "#(lf)")))

 

which refers to these two functions: 

 

getRemaining = (text, list) => //Read from the column "Column1" and "Column2", "Column3", "Column4", "Column5"
    let 
        Combined = if text <> null then let
        list1 = Text.Split(text, "#(lf)"),
        temp = List.Difference(list1, list), //Look for matches; Fitlering them out
        Combined = removeMultipleSpaces(Text.Combine(temp, " "))
        in
        Combined
        else Combined= null
    in
        Combined, //Returns all NOT matching results

    removeMultipleSpaces = (text) =>
    let
        //Split the text at each space character
        SplitText = Text.Split(text," "),
        //Remove the blank items from the list
        ListNonBlankValues = List.Select(SplitText,each _<> ""),
        //Join the list with a space character between each item
        TextJoinList = Text.Combine(ListNonBlankValues," ")
    in
        TextJoinList,

 

It works perfectly fine and does what it should do but as soon as I replace the "test   test" with a reference to a column [Column1] it gives me this error:

 

Expression.Error: The import Combined matches no exports. Did you miss a module reference?

 

1 ACCEPTED SOLUTION

Yes, I see that in the function steps, however, did you test nulls?  What value and type is in Column 1?  The reason I ask is because when if statements are included in functions and the function is invoked, the behavior is slightly different than it would be if included outside of the function.

View solution in original post

3 REPLIES 3
jennratten
Super User
Super User

What is the value and type of Column1?  Are there any nulls?  What happens if you pass null instead of "test test"?

 

Anonymous
Not applicable

It can be null and text. For null I made a special case: Combined = if text <> null then let ... else Combined = null

Yes, I see that in the function steps, however, did you test nulls?  What value and type is in Column 1?  The reason I ask is because when if statements are included in functions and the function is invoked, the behavior is slightly different than it would be if included outside of the function.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors