I have a column in Power BI that contains difference Operating System such as Windows 7 Professional and Windows 7 Home "etc" I would like to just have them show Windows 7. I thought using the find and replace searching for Windows 7* and replace with Windows 7 would work but it seems that Power BI does not recognize the * unless I am doing this wrong.
1 Answer
This is not currently possible in the GUI. I recommend adding your support for this idea to increase the likelihood of Microsoft implementing it:
Ability to use wildcards in power query transformation find section of replace values
In the meantime, you can do a workaround using the Text.Contains
function.
Here is an example from TechNet:
let
inputString = Excel.CurrentWorkbook(){[Name="InputString"]}[Content][Column1]{0},
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added Custom" = Table.AddColumn(Source, "Modified Values", each [Values]),
replaceTextIfContains = (inputText, old, new) =>
if (inputText is text and Text.Contains(inputText, old)) then
new
else
inputText,
#"Replaced Value" = Table.ReplaceValue(#"Added Custom",inputString ,inputString, replaceTextIfContains,{"Modified Values"})
in
#"Replaced Value