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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ccarpent
Helper IV
Helper IV

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


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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors