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>
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