Remove Digits or Keep them in Power BI Using Power Query

There are a couple of useful actions that help a lot in cleaning data; removing digits, or keeping digits and removing everything else. In this short blog article, I’ll explain a simple method to do that using Power Query.

Sample Data

My sample data table looks like this:

sample input data

Removing Digits

I can easily get rid of all digits wherever they are, using this action: adding a custom column:

Add Custom Column

Then the expression below (remember to use your column name instead of Column1 in the below expression):


And here is the result;

all digits removed

Digits would be removed regardless of where they are in the text easily using the Text.Remove Power Query Function. And I used a list of digits from zero to nine to have all the range included.

Keeping Digits, Removing Everything Else

If you want to do the opposite of this action, after creating a custom column, you can use the code below;


This is, in fact, the opposite of previous action, it first finds all non digits (similar to the previous process), and then removes them to have only digits. and here is the result:

Keeping digits only

There are other methods to achieve the same results as well, however, these methods work simple and workable.


Reza Rad on FacebookReza Rad on LinkedinReza Rad on TwitterReza Rad on Youtube
Reza Rad
Trainer, Consultant, Mentor
Reza Rad is a Microsoft Regional Director, an Author, Trainer, Speaker and Consultant. He has a BSc in Computer engineering; he has more than 20 years’ experience in data analysis, BI, databases, programming, and development mostly on Microsoft technologies. He is a Microsoft Data Platform MVP for 12 continuous years (from 2011 till now) for his dedication in Microsoft BI. Reza is an active blogger and co-founder of RADACAD. Reza is also co-founder and co-organizer of Difinity conference in New Zealand, Power BI Summit, and Data Insight Summit.
Reza is author of more than 14 books on Microsoft Business Intelligence, most of these books are published under Power BI category. Among these are books such as Power BI DAX Simplified, Pro Power BI Architecture, Power BI from Rookie to Rock Star, Power Query books series, Row-Level Security in Power BI and etc.
He is an International Speaker in Microsoft Ignite, Microsoft Business Applications Summit, Data Insight Summit, PASS Summit, SQL Saturday and SQL user groups. And He is a Microsoft Certified Trainer.
Reza’s passion is to help you find the best data solution, he is Data enthusiast.
His articles on different aspects of technologies, especially on MS BI, can be found on his blog:

5 thoughts on “Remove Digits or Keep them in Power BI Using Power Query

Leave a Reply