cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Nahuatl_C137 Regular Visitor
Regular Visitor

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

Accepted Solutions
Moderator v-yuezhe-msft
Moderator

Re: Integer Extraction function returning Expression.Error Message

@Nahuatl_C137,

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

Community Support Team _ Lydia Zhang
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

2 REPLIES 2
Moderator v-yuezhe-msft
Moderator

Re: Integer Extraction function returning Expression.Error Message

@Nahuatl_C137,

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

Community Support Team _ Lydia Zhang
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

Nahuatl_C137 Regular Visitor
Regular Visitor

Re: Integer Extraction function returning Expression.Error Message

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
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors