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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Identify if string is made if of numeric values

Hi

 

I am trying to identify on my report, using PowerQuery, if a purchadse order number; the column is declared as a text value, had/is all nuermic values.  A number of Purchase orders numbers are prefixed with a letter(s).   I wanted to flag these as they are a different type of order.

 

I am using a couple of snippets taken from the web and came up with this:

 

=if
List.AllTrue({
Text.Length([PurchaseOrder])=7,
Value.Is(

              Number.From([PurchaseOrder])

                   )

                 })
then "YES"
else "NO"

 

 

So I am checking if a purchase order text lenght = 7 chatacters, then I want to check if they are all nuermic.  Its seems to partially work, ie its understands if it is all numeric, its just when it encounters a text character if fails and throughs up an error for thoses rows.

I asusmed adding this to an IF statement the outcomes would be false and I get my answer.

Chris.

 

 

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

One way to do it is to add a custom column with this formula, which will return True for number rows and False for ones with letters.

 

=Value.Is(Value.FromText([Column1]), type number)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Employee
Employee

One way to do it is to add a custom column with this formula, which will return True for number rows and False for ones with letters.

 

=Value.Is(Value.FromText([Column1]), type number)

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

PAt

 

So simple when you know how, that sgreta thanks.  

 

Are you able to tell me the difference between 'type number' and 'Number.Type'

 

Chris

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors