Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
E.g., in I can have this string value in the column:
Раrtizаn
I would like this value to appear as
Partizan
Is it possible to transform a string which can contain any number of any HTML symbol (not using R or Py) ?
Solved! Go to Solution.
Html.Table works brilliantly! Full inspectable code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDAyUzY0MDWzhrPNjayLSjKrkPl5SrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"col1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "HtmlStep", each Html.Table([col1],{{"HtmlDecoded",":root"}})),
#"Expanded HtmlStep" = Table.ExpandTableColumn(#"Added Custom", "HtmlStep", {"HtmlDecoded"}, {"HtmlDecoded"})
in
#"Expanded HtmlStep"
Or without a new column:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDAyUzY0MDWzhrPNjayLSjKrkPl5SrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"col1", type text}}),
Decoded = Table.TransformColumns(#"Changed Type",
{{ "col1", each Table.FirstValue(Html.Table(_,{{"HtmlDecoded",":root"}})) }} )
in
Decoded
Html.Table works brilliantly! Full inspectable code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDAyUzY0MDWzhrPNjayLSjKrkPl5SrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"col1", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "HtmlStep", each Html.Table([col1],{{"HtmlDecoded",":root"}})),
#"Expanded HtmlStep" = Table.ExpandTableColumn(#"Added Custom", "HtmlStep", {"HtmlDecoded"}, {"HtmlDecoded"})
in
#"Expanded HtmlStep"
Or without a new column:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDAyUzY0MDWzhrPNjayLSjKrkPl5SrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [col1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"col1", type text}}),
Decoded = Table.TransformColumns(#"Changed Type",
{{ "col1", each Table.FirstValue(Html.Table(_,{{"HtmlDecoded",":root"}})) }} )
in
Decoded
Hi @Zyg_D
Yes you can do this, here's the M code to copy/paste into a blank query, and a sample PBIX file
let
Codes = [1056 = "P", 1072 = "a"],
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDAyUzY0MDWzhrPNjayLSjKrkPl5SrGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Text = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each List.RemoveMatchingItems(Text.SplitAny([Text],";&#"),{" "})),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Text.Combine(List.Transform([Custom], each try if Number.From(_) > 0 then Record.Field(Codes,_) else null otherwise _ ))),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Custom"})
in
#"Removed Columns"
I've created a Record with the codes for P and a , you will need to add whatever other codes you need to this. You could use a List or a Table Column just as well, but the above code will need to be modified to accomodate this.
The code splits the text into separate codes and letters, replaces the code with the letter from the Codes Record then recombines everything.
Regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Proud to be a Super User!
Thanks, @PhilipTreacy
This may work, but I would need to know beforehand which HTML codes I may get. Sadly I don't know what users will provide me with.
I know there is a DAX function UNICHAR, which decodes all those numeric values into symbols, but I don't know how to deploy it so that it would read any number of occurrences.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
User | Count |
---|---|
107 | |
68 | |
48 | |
44 | |
44 |