How to Extract Text from a Column in Power BI
Ever found yourself staring at a column of data in Power BI that’s almost perfect but contains extra text you don’t need? Maybe it’s a full name when you just need the first name, or a jumbled campaign ID with the channel name stuck inside. Getting that data into a clean, usable format is a common roadblock in building useful reports. This article will walk you through several easy-to-use methods inside Power BI to extract the exact text you need from any column, no advanced coding required.
Why Would You Need to Extract Text?
Cleaning and shaping your data is the foundation of any good report. Extracting text from columns is a critical part of that process, often used to:
- Clean up messy data entries. Your data might have a column with "City, State, Zip" all crammed together. Extracting each part into its own column makes filtering and creating maps much easier.
- Create new fields for analysis. Imagine you have a product SKU like
TSHIRT-BLUE-LG. You could extract "TSHIRT," "BLUE," and "LG" to analyze sales by product category, color, or size. - Standardize data for relationships. Sometimes, a unique identifier you need to join tables is buried inside another field. Extracting it allows you to build the correct data model relationships.
- Isolate key information. You might want to analyze website traffic by domain, but your data only provides full referral URLs. Extracting the domain gives you a clean field for your charts.
Fortunately, Power BI's Power Query Editor is built to handle these exact scenarios with clicks, not code.
Your Data Shaping Command Center: The Power Query Editor
Before you can start transforming columns, you need to know where to go. All the magic happens in the Power Query Editor, which is a separate window from your main Power BI dashboard view. Think of it as your workshop where you prepare and clean your raw data before it gets loaded into your report for visualization.
To get there, just click the "Transform data" button on the Home tab of the main Power BI Desktop ribbon. This will open the Power Query Editor, where you’ll see previews of your data tables. Now, you’re ready to start extracting.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Method 1: The Quick Win with "Split Column by Delimiter"
The "Split Column" feature is your best friend when your text is neatly separated by a character, known as a delimiter. This could be a space, comma, hyphen, or any other symbol. It takes the original column and breaks it into multiple new columns based on where that delimiter appears.
Use Case Example: You have a "Full Name" column and want to create separate "First Name" and "Last Name" columns.
Step-by-Step Instructions:
- In the Power Query Editor, find and select the column you want to split (e.g., "Full Name"). Your selected column will be highlighted.
- Navigate to the "Home" tab on the Power Query ribbon and click on "Split Column." A dropdown menu will appear.
- Select "By Delimiter."
- A new window will pop up. Power BI is pretty smart and will often guess the correct delimiter. In our example, it will likely select "Space." If not, you can choose from the list or enter a custom character.
- Under "Split at," you have a few powerful options:
- For our name example, "Left-most delimiter" works perfectly. Click "OK."
Power Query will replace your "Full Name" column with "Full Name.1" and "Full Name.2". The final step is to double-click on the new column headers and rename them to something intuitive, like "First Name" and "Last Name."
Method 2: Isolate Text with the "Extract" Feature
What if you don't want to split the column into multiple pieces? What if you just want to grab one specific part of the text? This is where the "Extract" feature shines. Instead of splitting the column, it creates a new column containing only the text you specify - before, after, or between delimiters.
Use Case Example: You have a list of email addresses and you want to analyze sign-ups by company domain.
Step-by-Step Instructions:
- Select the column containing your data (e.g., "Email").
- Go to the "Add Column" tab on the ribbon. We use "Add Column" here instead of the "Transform" tab because we want to create a new "Domain" column while keeping the original "Email" column intact.
- Click on the "Extract" option in the "From Text" group.
- You’ll see several fantastic options:
- Select "Text After Delimiter." A small window will appear asking for the delimiter. Type "@" and click "OK."
Voila! A new column named "Text After Delimiter" appears, containing just the domains from your email list. Don't forget to rename this column to "Domain" for clarity. You've just created a new dimension for your report in just a few clicks.
Method 3: Let Power BI Do the Work with "Column From Examples"
If your text extraction needs are more complex and don’t follow a simple delimiter rule, "Column From Examples" is a game-changer. This feature uses AI to detect a pattern in your desired output. You simply provide one or two examples of what you want to extract, and Power BI writes the underlying transformation formula for you.
Use Case Example: You have a column with complex Log IDs like LOG_2024-03-15_USER123_FAILED. You just want to extract the date, "2024-03-15". A simple delimiter split won't work easily here.
Step-by-Step Instructions:
- Select the messy column (e.g., "Log ID").
- Go to the "Add Column" tab and click "Column From Examples."
- A new, blank column will appear on the right side of your table preview.
- Click on the first empty cell in this new column. Based on our first row
LOG_2024-03-15_USER123_FAILED, type the output you want: 2024-03-15. Press Enter. - Power BI will analyze what you did and try to guess the pattern for the rest of the entries. Sometimes it gets it right on the first try. Other times, you may need to give it a second example in the next row to help it lock in the correct pattern.
- As you type, review the grayed-out "previews" it generates for the rest of your rows. If they all look correct, you're good to go.
- Click "OK."
Power BI will create the new column with your beautifully extracted text and even shows you the complex M language formula it generated at the top of the screen. You just accomplished a complex transformation without writing a line of code.
A Quick Look at Advanced Methods: DAX and M Code
While the UI buttons cover 95% of use cases, it's helpful to know there are more powerful tools available for even trickier scenarios.
Custom Columns with Power Query (M Language)
Every click you make in the Power Query Editor generates a script in a language called M code. For very specific custom logic, you can write your own M formulas in a custom column. For example, to get text before the "@" in an email, you could click "Add Column" > "Custom Column" and enter this formula:
Text.BeforeDelimiter([EmailColumnName], "@")
This gives you ultimate flexibility if the built-in functions don't quite fit your needs.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Calculated Columns with DAX
You can also extract text after the data is loaded into Power BI using DAX Calculated Columns. It's generally better for performance to do these transformations in Power Query first, but DAX is an option. To replicate the "First Name" extraction, you might create a new calculated column in the Data view with a formula like this:
First Name = LEFT( 'YourTable'[Full Name], FIND(" ", 'YourTable'[Full Name]) - 1 )
DAX is more suited for performing calculations and aggregations on your model, but its text functions like LEFT, RIGHT, MID, and FIND offer another path to the same goal.
Final Thoughts
Cleaning your data no longer has to be an intimidating chore. As you can see, Power BI equips you with a whole toolbox of user-friendly features for extracting text, whether you’re breaking data apart with delimiters, pulling out specific segments, or teaching an AI engine your custom rules. Mastering these techniques will massively speed up your workflow and unlock new analytic possibilities.
Ultimately, quick and painless reporting is the goal. At our company, we built Graphed because we believe getting insights shouldn't require you to manually click through menus to clean and prepare your data in the first place. By connecting your tools like Google Analytics, Shopify, and Salesforce directly and then simply asking plain-English questions like, "Show me revenue by product category from our latest Facebook campaign," you skip right to the answers - letting our AI data analyst handle all the data prep for you.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.