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

Integer Extraction function returning Expression.Error Message

Through some research, I found this formula to extract numbers only to use in my queries. Since it is used often, I want to write a function from it. However, I can't seem to make it work properly. I'll paste an example of how I use it regularly, and the function I wrote from it which is giving me an error.

 

This is a snippet that works just fine:

 

image.png

 

Below is a snippet of the function which is giving me errors:

 

The error message reads as: Expression.Error: The name '_' wasn't recognized.  Make sure it's spelled correctly.

 

In addition, I would like to know what causes Expression.Error messages. In this case, I understand that the underscore isn't defined. However, why does it seem to work fine within the image above?

 

image.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous,

Please check the following code.

let intextaction=(AlphaNumeric as  text)=>

let
    Source = Text.Combine(List.RemoveNulls(List.Transform(Text.ToList(""&AlphaNumeric&""),each if Value.Is(Value.FromText(_), type number) then _ else null)))
in
    Source

in
   intextaction

1.PNG

Regards,
Lydia

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Anonymous,

Please check the following code.

let intextaction=(AlphaNumeric as  text)=>

let
    Source = Text.Combine(List.RemoveNulls(List.Transform(Text.ToList(""&AlphaNumeric&""),each if Value.Is(Value.FromText(_), type number) then _ else null)))
in
    Source

in
   intextaction

1.PNG

Regards,
Lydia

Anonymous
Not applicable

Lydia,

 

Thank you, this solved the problem. After looking closely, the List.Transform method requires an "each" statement (not sure if that's how you say it "each statement"?).

 

The AlphaNumeric variable can go in there without having any quotes or ampersands.

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.