Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am attempting to extract HTML text by creating a custom column but keep the rows with regular text at the same time. I have used this code to remove the HTML text but am missing the part where it keeps the rows with regular text:
= if Text.StartsWith([Final Decision Notes], "<") then
Table.Combine({
Html.Table("<div>" & [Final Decision Notes] & "</div>", {{"Final Decision Notes", "div"}}),
Html.Table("<div>" & [Final Decision Notes] & "</div>", {{"Final Decision Notes", "br"}})
})
else
#table({"Final Decision Notes"}, {{ [Final Decision Notes] }})
What am I missing?
you can define the following function and use it in your code
(inputText as text) as table =>
if Text.StartsWith(inputText, "<") then
Table.Combine({
Html.Table("<div>" & inputText & "</div>", {{"Final Decision Notes", "div"}}),
Html.Table("<div>" & inputText & "</div>", {{"Final Decision Notes", "br"}})
})
else
#table({"Final Decision Notes"}, {{ inputText }})
Hi @LoMorrissey
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If your issue resolved, kindly mark the helpful response and accept it as the solution to assist other community members in resolving similar issues more efficiently. If not, please provide detailed information so we can better assist you.
Hi,
I asked one of my colleagues and he was able to give me this code which solved the issue:
#"Added Custom" = Table.AddColumn( #"Replaced Value24" , "Custom", each if [Review Team Notes] = null or not Text.Contains([Review Team Notes], "<") then
"<p>" & [Review Team Notes] & "</p>"
else
[Review Team Notes]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each if [Custom] <> null then
Html.Table([Custom], {{"text", ":root"}})
else
[Custom]),
#"Expanded Custom.1" = Table.ExpandTableColumn(#"Added Custom1", "Custom.1", {"text"}, {"Custom.1.text"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom.1",{"Review Team Notes", "Custom"}),
#"Renamed Columns12" = Table.RenameColumns(#"Removed Columns",{{"Custom.1.text", "Review Team Notes"}}),
#"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns12",{{"Review Team Notes", type text}})
in
#"Changed Type2"
Hi @LoMorrissey
Welcome to the Microsoft Fabric Community Forum.
The issue observed in Power BI, involving the extraction of HTML content while retaining plain text rows, is primarily due to inconsistencies in the conditional logic used within the custom column formula. The current implementation utilizes Html.Table to parse HTML content when the text begins with an HTML tag indicator (such as <), but fails to maintain a consistent output structure for rows containing plain text. This discrepancy can lead to schema misalignment during data transformation.
To address this, it is recommended to ensure that both HTML and non-HTML rows are returned in a uniform table format. This can be achieved by wrapping plain text rows in a table structure that mirrors the output of the HTML parsing logic.
= if Text.StartsWith([Final Decision Notes], "<") then
Table.Combine({
Html.Table("<div>" & [Final Decision Notes] & "</div>", {{"Final Decision Notes", "div"}}),
Html.Table("<div>" & [Final Decision Notes] & "</div>", {{"Final Decision Notes", "br"}})
})
else
#table({"Final Decision Notes"}, {{ [Final Decision Notes] }})
For reference:
Html.Table - PowerQuery M | Microsoft Learn
Thank you for being part of Fabric Community Forum.
Regards,
Karpurapu D,
Microsoft Fabric Community Support Team.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
9 | |
7 | |
6 |