ADVERTISEMENT
  • About
  • Advertise
  • Privacy & Policy
  • Contact
Office Learner
ADVERTISEMENT
  • Home
  • Excel
  • Word
  • PowerPoint
  • Outlook
  • Microsoft Copilot
  • Power BI
  • Microsoft 365
  • Microsoft Teams
  • OneNote
No Result
View All Result
  • Home
  • Excel
  • Word
  • PowerPoint
  • Outlook
  • Microsoft Copilot
  • Power BI
  • Microsoft 365
  • Microsoft Teams
  • OneNote
No Result
View All Result
Office Learner
No Result
View All Result
Home Power BI

Remove decorative hyphens from a copied label with Power Query Text Remove

Tanjila Rashid by Tanjila Rashid
November 28, 2026
in Power BI
0
Remove decorative hyphens from a copied label with Power Query Text Remove
0
SHARES
3
VIEWS
Share on FacebookShare on Twitter

Remove decorative hyphens from a copied label with Power Query Text Remove

Use Text.Remove([Label], "-") in a Power Query custom column to create a copy of a text label with every hyphen removed. For example, AB-07 becomes AB07. Keep the original label beside the result so you can review the change. This is appropriate only when your source convention says those hyphens are decorative separators. A hyphen can be meaningful, and removing it without a rule can merge identifiers that were supposed to remain different.

Build an original practice table

In Power BI Desktop, create a small table with a Text column named Label and the values AB-07, AB07, and X-2-4. Open Transform data to inspect the table in Power Query Editor. Check the column's data type before writing the expression. These are labels rather than quantities, so Text is the intended type. Do not convert the identifiers into numbers to simplify them. Letters, leading zeros, and separators can carry information that a numeric conversion would either reject or discard.

Choose Add Column, Custom Column, and name the result Label without hyphens. Enter Text.Remove([Label], "-") in the formula area. The expected results are AB07, AB07, and X24. Notice that the expression removes both hyphens from X-2-4, not just the first. It operates on specified characters wherever they occur. This makes it convenient for a documented cleanup, but it also makes a careful choice of removed characters essential. The examples are reproducible exercises rather than claims of hands-on desktop testing.

Inspect the collision immediately

The first two inputs now produce the same result. AB-07 and AB07 both become AB07. That is a collision: different source values map to one cleaned value. Whether it is acceptable depends on the data contract. If both original labels are recognized spellings of the same bin, normalization may be intentional. If they refer to different bins, the transformation would destroy a distinction. Do not use the cleaned result as a relationship key or merge field until you have checked this issue with the source owner.

Keeping the original column makes this risk visible. You can sort or group the cleaned result during investigation and inspect which original labels share it. The purpose of that review is to understand the mapping, not to delete duplicate-looking rows automatically. Several records may legitimately describe different transactions for the same label. Separate the question of whether two labels mean the same thing from the question of whether entire records are duplicates. A text cleanup alone answers neither business question.

Understand the removal argument

Text.Remove can take a character or a list of characters to remove. For a second disposable example, Text.Remove([Label], {"-", " "}) removes both hyphens and ordinary spaces. The braces create the M list used by this expression. Do not add characters casually to make the result look tidy. Removing a space inside a phrase such as Room A changes its written form, and removing punctuation from a signed quantity would be a different and potentially incorrect task. Keep the demonstration limited to a label column with a clear convention.

This is character removal, not replacement of an entire word or substring according to its position. If you need to remove only a particular prefix or only the final separator, use a transformation designed for that narrower condition. Reusing Text.Remove because it is short can remove matching characters from places you meant to preserve. Write your intended rule in a sentence first, then check that the expression implements exactly that sentence. Every ordinary hyphen in the value is removed is a precise description of this exercise.

Check unusual characters and missing values

An ordinary hyphen is not the same character as every dash you can see on a page. Text copied from a document may include an en dash or another Unicode mark. If a separator remains after your transformation, inspect the actual source character rather than assuming the function missed it. Do not expand the removal list to every punctuation mark without reviewing examples. A visual resemblance can hide a meaningful encoding difference, and a broad cleanup can conceal inconsistent source entry that deserves a separate correction.

ADVERTISEMENT

The documented function accepts nullable text. Preserve missing values according to your model's rules rather than inventing a label for them during punctuation cleanup. If the expression raises a type error, check for nontext values and earlier conversion steps. A raw numeric value does not become a valid identifier merely because you turn it into text. Protect the source representation first, then define the cleaning rule and test it on representative records, including values with no hyphens and values with several.

Review the step before applying it

Look at Applied Steps and keep the new column name descriptive. Avoid renaming the cleaned copy to the original name until the mapping has been reviewed. Add a note in your transformation documentation stating which characters are removed and why. Microsoft documents Text.Remove as a Power Query M function; this walkthrough uses Power BI Desktop's query editor, while other Power Query hosts may arrange the menus differently. The expression and the business rule should remain understandable even when the interface changes.

For practice, add A-B, AB, and A–B. Predict the cleaned output for each and explain why all three become AB. Then decide whether that would be acceptable for a fictional shelf-label system. Finally, propose one label where a hyphen must remain and explain why this expression should not be applied to that field. A good cleanup is not merely a shorter string. It is a documented transformation whose effects, collisions, and exceptions you can explain before using the result in a report.

Sources and related reading

Primary reference and scope

Split a Combined Code in Power BI Power Query

Tags: Power BIpractical guide
ADVERTISEMENT
Previous Post

Remove a transition from one PowerPoint slide

Next Post

Apply strikethrough to a withdrawn instruction in OneNote for the web

Tanjila Rashid

Tanjila Rashid

Next Post
Apply strikethrough to a withdrawn instruction in OneNote for the web

Apply strikethrough to a withdrawn instruction in OneNote for the web

ADVERTISEMENT
  • Trending
  • Comments
  • Latest
10 Microsoft 365 Copilot Features That Transform Word and Outlook in 2025

8 Hidden Excel Features That Power Users Swear By (2026 Edition)

October 8, 2026
PowerPoint Morph Transition Masterclass: Create Cinematic Animations in 2026

PowerPoint Morph Transition Masterclass: Create Cinematic Animations in 2026

October 8, 2026
Excel GROUPBY & PIVOTBY: The New Array Functions That Replace PivotTables

Excel GROUPBY & PIVOTBY: The New Array Functions That Replace PivotTables

October 8, 2026
Excel PIVOTBY Function in 2026: The Ultimate Guide to Dynamic Pivot Analysis Without Pivot Tables

Excel PIVOTBY Function in 2026: The Ultimate Guide to Dynamic Pivot Analysis Without Pivot Tables

October 8, 2026
Spreadsheet Layout

What is spreadsheet? and how it works!

0
Spreadsheet Layout

Spreadsheet Layout

0
Spreadsheet Layout

IF function of Google Sheets – usage and formula examples

0

5 Google Sheets tricks that you always need!

0
Apply strikethrough to a withdrawn instruction in OneNote for the web

Apply strikethrough to a withdrawn instruction in OneNote for the web

November 28, 2026
Remove decorative hyphens from a copied label with Power Query Text Remove

Remove decorative hyphens from a copied label with Power Query Text Remove

November 28, 2026
Remove a transition from one PowerPoint slide

Remove a transition from one PowerPoint slide

November 28, 2026
Convert an all capitals Word heading to sentence case

Convert an all capitals Word heading to sentence case

November 28, 2026

Recent News

Apply strikethrough to a withdrawn instruction in OneNote for the web

Apply strikethrough to a withdrawn instruction in OneNote for the web

November 28, 2026
Remove decorative hyphens from a copied label with Power Query Text Remove

Remove decorative hyphens from a copied label with Power Query Text Remove

November 28, 2026
Remove a transition from one PowerPoint slide

Remove a transition from one PowerPoint slide

November 28, 2026
Convert an all capitals Word heading to sentence case

Convert an all capitals Word heading to sentence case

November 28, 2026
Office Learner

OfficeLearner is a place where you can learn PowerPoint, Excel, Word Data Analysis, and other Office related programs. We provide tips, how to guide and also provide Excel solutions to your business problems

Follow Us

DMCA.com Protection Status

Browse by Category

  • Clipchamp
  • Excel
  • Google Sheets
  • Loop
  • Microsoft 365
  • Microsoft Copilot
  • Microsoft Designer
  • Microsoft Forms
  • Microsoft Loop
  • Microsoft Sway
  • Microsoft Teams
  • Microsoft Viva
  • Microsoft Whiteboard
  • OneDrive
  • OneNote
  • Outlook
  • Planner
  • Power Apps
  • Power Automate
  • Power BI
  • PowerPoint
  • SharePoint
  • Teams
  • Visio
  • Word

Recent News

Apply strikethrough to a withdrawn instruction in OneNote for the web

Apply strikethrough to a withdrawn instruction in OneNote for the web

November 28, 2026
Remove decorative hyphens from a copied label with Power Query Text Remove

Remove decorative hyphens from a copied label with Power Query Text Remove

November 28, 2026
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2022 OfficeLearner - Free Excel, PowerPoint & Word Tutorial & Online Courses

No Result
View All Result

© 2022 OfficeLearner - Free Excel, PowerPoint & Word Tutorial & Online Courses

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.