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
Anonymous
Not applicable

Is there an ISNUMBER() or ISTEXT() equivalent in Power Query

Hi Folks,

While data cleaning using the power query, I came across a situation where a column contains both text and numerical values. I want to add an additional column that states which one is number or text. In Excel, we have ISNUMBER() or ISTEXT().  Do we have any alternative in Power Query? Below is an Excel screenshot, an alternative of which want in Power Query.

 

sankalp_0-1601213729126.png

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

like what @CNENFRNL  suggested, you can try

if Value.Is([data],type number) 
then "Number"
else "Text"

 1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@Anonymous 

like what @CNENFRNL  suggested, you can try

if Value.Is([data],type number) 
then "Number"
else "Text"

 1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi,
It is not working when you have column type text - then results is always Text,
It works when you first get valuefrom text, and then check type.

Value.Is(Value.FromText([data]), type number))

Thanks @QooT,

I was having this issue and even though my column data type was "Any", for whatever when PowerQuery parsed in the data everything became a string, so even values of 123 were resulting in Text, however your adjustment to the formula fixed this, so thanks!

 

 

IsNumber
--------
= if Value.Is(Value.FromText([--column-name-here--]), type number)
then "Y"
else "N"

 

CNENFRNL
Community Champion
Community Champion

Hi, @Anonymous , you may try Vaue.Is function,

https://docs.microsoft.com/en-us/powerquery-m/value-is


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.