admin管理员组

文章数量:1125015

I have a Power BI dataset with one column that contains HTML tags. I have tried to make a custom column with the following code:

try Html.Table([HTML Text],{{"PlainText",":root"}}) otherwise null

However, when I do this the values from the original column are all over the place. Some rows which did not contain any text, now do and vice versa. Am I doing something wrong? It is important that the values remain in their original rows if that makes sense. So I would like to exclude the HTML tags from my column while keeping the text in the right rows.

Below is an example:

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;">Allen,</span></p><p class="ql-align-justify"></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;"></span></p><p class="ql-align-justify"> </p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;">Zie onder het antwoord van </span></p><p class="ql-align-justify"></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;">Het antwoord lijkt mij afdoende zo, tenzij jullie nog aanvullende vragen of opmerkingen hebben?</span></p><p class="ql-align-justify"></p>

I have a Power BI dataset with one column that contains HTML tags. I have tried to make a custom column with the following code:

try Html.Table([HTML Text],{{"PlainText",":root"}}) otherwise null

However, when I do this the values from the original column are all over the place. Some rows which did not contain any text, now do and vice versa. Am I doing something wrong? It is important that the values remain in their original rows if that makes sense. So I would like to exclude the HTML tags from my column while keeping the text in the right rows.

Below is an example:

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;">Allen,</span></p><p class="ql-align-justify"></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;"></span></p><p class="ql-align-justify"> </p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;">Zie onder het antwoord van </span></p><p class="ql-align-justify"></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri, sans-serif;color:#1F497D;">Het antwoord lijkt mij afdoende zo, tenzij jullie nog aanvullende vragen of opmerkingen hebben?</span></p><p class="ql-align-justify"></p>

Share Improve this question edited 2 days ago Sam Nseir 11.6k2 gold badges4 silver badges20 bronze badges asked 2 days ago MagdalenaMagdalena 11 bronze badge New contributor Magdalena is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 0

I'm not sure why that happened for you. Did the rows mess up directly at this step or another step further down?

Try updating your Custom Column to:

try Html.Table([HTML Text], {{"PlainText",":root"}}){0}[PlainText] otherwise null

Or to this one if you want to remove excess whitespace:

try Text.Clean(Html.Table([HTML Text], {{"PlainText",":root"}}){0}[PlainText]) otherwise null

本文标签: powerbiPower BIRemove all HTML tags in one columnStack Overflow