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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

I need to filter out the rows that start with a letter followed by numbers (e.g., "A6300").

I need to filter out the rows that start with a letter followed by numbers (e.g. "A6300"). Is there any way to do so in Power Query? 

4 REPLIES 4
jribs
Helper I
Helper I

For anyone still looking for a solution, it can be done in PowerQuery. The answer and explanation are below

 

Solution

if List.Contains({"0".."9"},Text.Start([YourColumnWithValues], 1)) then "Number" else "Letter"

 PowerQuery Formula should look like

= Table.AddColumn(#"Previous Step", "ThisStep", each if List.Contains({"0".."9"},Text.Start([YourColumnWithValues], 1)) then "Number" else "Letter")

 

Explanation

List.Contains takes a list and a text phrase to find in that list, then returns a true or false if it is found. So the strategy is to make a list of numbers and see if the first character of the column we are looking at has a number and label it accordingly. We use {"0".."9"} to make a quick iteration of numbers for our first argument. To get the letter, we use Text.Start with a length argument of 1 to get the first character. The rest is basic Power Query syntax. That's it

TotunG
Resolver I
Resolver I

Not sure of the PBI solution but I guess you mean like in Excel where you use a 'wildcard' character like "?????". Although don't think these work with numbers.

Anonymous
Not applicable

@TotunG , I want to restrict my data using power query

Not sure if this is that possible in Power Query. You can apply many conditions to try filter these values but think its best to do it in source data.

 

Also think you might be able to use wildcard characters in Power BI filters but thats about it.

 

See below for more info:

 

https://community.powerbi.com/t5/Power-Query/How-to-use-wild-cards-like-and-ind-power-query-filter-l...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.