Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
26.5k views
in Power BI by 3 3 6
retagged by

How to extract only numbers from text in power bi?

I have the below table, and I need to create a new caclulated column to keep only numbers from string?

string and number Result only number
Alex2020A1 20201
Sara2021A2 20212
Karlos2022A500 2022500

1 Answer

1 like 0 dislike
by 159 198 381
selected by
 
Best answer

Power BI: How to Extract only numbers from String?

To remove all characters and show only numbers in a string in Power BI, you should do the following:

Steps

  1. At the Home tab, click on "Edit Queries".

    edit queries in power bi

  2. The Power Query Editor would be Opened.
  3. From the left side, Select your table.
  4. At the Add column tab, click on Custom Column.

    create a custom column in power bi

  5. Write the below formula based on your column name.

Using Text.Select()

You can use Text.Select() to extract only numbers from a string in Power BI

= Text.Select([String],{"0".."9"})

extract number from string power bi

Using Text.Remove()

Also, You can use Text.Remove() to extract only numbers from a string in Power BI

= Text.Remove([String],{"A".."z"})

Output

extract only numbers from string power bi


Download

If you don’t ask, the answer is always NO!
...