User Profile
nbkviou
Frequent Visitor
Joined 8 years ago
User Widgets
Contributions
Re: Replace character only at the beginning of string using Power Query
Thanks for the response this worked. I just had one extra question to ask. I was trying to create a list of prefixes that i wanted to remove. Prefix_List KR- AMPS- ADC- COMM COM Reported_Client_Sku_Code AMPS-0-1710731-2 AMPS-1-1710733-1 KR-66452780-07 KR-66452783-07 KR-66452787-07 For example, So all Reported_Client_Sku_Code's that have KR- would be removed. I came up with the following code but i think i'm missing something cause i get an error that the list doesn't match any rows in the table. I think there is a little something that i'm missing from my code. The List Table name is "Prefix_List." The Table that contains Reported_Client_Sku_Code is "Exceptions_Raw_Data_Formatted_Output". let Source = Excel.CurrentWorkbook(){[Name="Exceptions_Raw_Data_Formatted_Output"]}[Content], PrefixList = Source{[Name="Prefix_List"]}[Content], #"Added Custom" = Table.AddColumn(PrefixList,"Result", each Text.Remove([Reported_Client_Sku_Code],PrefixList)) in #"Added Custom"27KViews0likes0CommentsRe: Replace character only at the beginning of string using Power Query
Thanks. This is good. It gives me an idea of something else i was trying to figure out. There's one issue i have trying to use this is that will remove all the letters which except the first 3,4, or 5. I'm dealing with part numbers for a company for there is letter in the middle and end of the number i need to keep. But the letters at the beginning of the part number are abbreviations for different company names which i'm trying to replace. For example, Part Number Desired Number AMP45789A 45789A BECI71364579F 71364579F The consistency won't be a problem cause i'll specify myself what the beginning characters are and the length they are. I've just been racking my brain how to adjust the code i found to remove the beginning letters only.34KViews0likes5CommentsRe: Replace character only at the beginning of string using Power Query
Hi, I want to remove the letters at the beginning of the number. They could start with 3 letters, 4 letters, or 5 letters. I'm going to specify in the code the letters that i want to cut off. AMP is an example. I don't want to do a custom column cause that will cause alot of extra columns and be less efficient. I have the code i need to do this but it takes off the characters at the end opposed to the beginning. I'm trying to figure out how to adjust the code below 'This takes the last 3 characters off instead of the beginning' =Table.TransformColumns(previous step, {{“Column to Appy”, each if Text.StartsWith(“AMP”) Then Text.Start(_,Text.Length(_)-3) else _,}})34KViews0likes7CommentsRe: Replace character only at the beginning of string using Power Query
I'm not trying to create a custom column. I'm trying to do it on the actual column. I don't think that will work cause that will remove the first 3 characters of every ID and its not consistent throughout the file. It can be 3 letters, 4 letters, or 5 letters. The code i mentioned above works except it takes off the last 3 characters as opposed to the first 3. That's why i've been trying to figure out.34KViews0likes9CommentsRe: Replace character only at the beginning of string using Power Query
AMP isn't consistent throughout the file. It can be in different positions. I've used the replace button option before when it was consistent. I'm trying to remove the first 3 characters. I have found code to remove characters except it does it at the end. I need it to do it at the beginning. This is the code i found. =Table.TransformColumns(previous step, {{“Column to Appy”, each if Text.StartsWith(“AMP”) Then Text.Start(_,Text.Length(_)-3) else _,}})34KViews0likes11CommentsReplace character only at the beginning of string using Power Query
Hi, I'm trying to figure the M code to replace characters at the beginning of a string in Power Query. For example, AMP19336713 AMP5541921 AMP65534531 I want to replace the first 3 characters "AMP" with blanks so it reads instead 19336713 5541921 65534531 What is an example of code to help me achieve this? Thank youSolved34KViews0likes13Comments
Data Privacy
Microsoft Fabric Community and Privacy
To learn more about how we manage your data, please review the Microsoft Fabric Community Data Privacy guide.