Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
common763
Helper III
Helper III

Remove HTLM tags from text in Power Query

We have a power app that is now connected to a Power BI report.  There is a column that has HTML tags and we would like to remove the <>, </> and tags inbetween the characters.  is there a good way to do this?  There are a plethora of tags so we cant hard code just need the tags completely removed.  Below is an example.  Thanks. 

 

<p>Compliance for report</p>

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Parse the HTML and ask Power Query to return only the payload text.

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

View solution in original post

6 REPLIES 6
v-prasare
Community Support
Community Support

@common763  As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for your issue worked? or let us know if you need any further assistance here?

 

@Omid_Motamedise@ronrsnfld@lbendlin, Thanks all for your promt response here.

 

 

 

Thanks,

Prashanth Are

MS Fabric community support

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly and give Kudos if helped you resolve your query

common763
Helper III
Helper III

Thanks for all of your help.  I ended up resolving this inside Power Query.  There is a link below that is a little dated but explains the process.  This removed the HTML tags and didnt need any expressions.

 

Using Power BI to Report on Rich Text Data Fields in SharePoint – The White Pages

Omid_Motamedise
Super User
Super User

you can initially find the positions of < and > and then use List.Accumulate to create a loop and remove any occurance using the following fomrul (a is your text)

 

= [a="<p>Compliance for report</p>", b=Text.PositionOf(Source,"<",Occurrence.All),c=Text.PositionOf(Source,">",Occurrence.All),d=List.Reverse(List.Zip({b,c})),e=List.Accumulate(d,a,(x,y)=>Text.RemoveRange(x,y{0},y{1}-y{0}+1))][e]
If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h
ronrsnfld
Super User
Super User

You might be able to use the Xml.Document function.

 

Or you can try this custom function: fnRemoveHTML

 

(html as text)=>
[a=Text.BetweenDelimiters(html,"<",">"),
 b=Text.Replace(html,"<" & a & ">",""),
 c=if Text.Length(html)> Text.Length(b) then fnRemoveHTML(b) else html][c]
lbendlin
Super User
Super User

Parse the HTML and ask Power Query to return only the payload text.

 

Please provide sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Here is the sample data coming from a Power App.

<p>Compliance for report</p> 

I need it to display

Compliance for report

 

Sorry, but I dont understand specifically what you mean by 

Parse the HTML and ask Power Query to return only the payload text.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors