Created
June 1, 2018 13:05
-
-
Save HansPeterPfister/a065dc67a02fc8cbe3a7b9ecfa32cd83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// code written by Hans Peter Pfister, www.powerbi-pro.com | |
(text as text) => | |
let | |
// Convert string into list, splitted by char | |
Table.FromList = Table.FromList(Text.ToList(text), Splitter.SplitByNothing(), null, null, ExtraValues.Error), | |
// Merge with table "Replacements" | |
Merge = Table.Buffer(Table.NestedJoin(Table.FromList,{"Column1"},Replacements,{"WrongValue"},"KorrekturLISTE",JoinKind.LeftOuter)), | |
Expand = Table.ExpandTableColumn(Merge, "KorrekturLISTE", {"WrongValue", "CorrectValue"}, {"WrongValue", "CorrectValue"}), | |
// Add column with correct values | |
Added_Column_with_corrections = Table.AddColumn(Expand, "Benutzerdefiniert", each if [Column1]=[WrongValue] then [CorrectValue] else [Column1]), | |
//Tidy up | |
Remove_Columns = Table.SelectColumns(Added_Column_with_corrections,{"Benutzerdefiniert"}), | |
Convert_to_List = Remove_Columns[Benutzerdefiniert], | |
Result = Text.Combine(Convert_to_List) | |
in | |
Result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment