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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

SharePoint HTML conversion for column values

I'm using a SharePoint 2013 list as a data source, the multiple lines of text column values are being displayed as HTML in the query editor.

 

Sample column value:

 

"<p>​EOD Tuesday<br></p></div>"

 

Is there any way to convert HTML column values to plain text?

 

Thanks

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Well, there is only "Text" in Desktop, no "HTML" format, so my guess is that your column in SharePoint is flagged as Rich Text versus Plain Text so you would need to change the column type in SharePoint, then it should strip out the HTML.

 

I am not aware of anything in DAX or "M" that will strip out HTML from text automagically but I'll look again.

 

Edit: Looks like your best bet is Text.Remove in "M"

https://msdn.microsoft.com/en-us/library/mt260472.aspx

 

You could give it arguments such as "<p>", "</p>", etc but the odds of stripping out all HTML, especially if there are attributes involved is pretty unlikely.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

Well, there is only "Text" in Desktop, no "HTML" format, so my guess is that your column in SharePoint is flagged as Rich Text versus Plain Text so you would need to change the column type in SharePoint, then it should strip out the HTML.

 

I am not aware of anything in DAX or "M" that will strip out HTML from text automagically but I'll look again.

 

Edit: Looks like your best bet is Text.Remove in "M"

https://msdn.microsoft.com/en-us/library/mt260472.aspx

 

You could give it arguments such as "<p>", "</p>", etc but the odds of stripping out all HTML, especially if there are attributes involved is pretty unlikely.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

"change the column type in SharePoint, then it should strip out the HTML"

 

This worked

diverdown1964
Most Valuable Professional
Most Valuable Professional

There is a way to handle this elegantly - documented here - https://whitepages.unlimitedviz.com/2018/04/power-bi-report-rich-text-sharepoint/

This worked like a charm & so easy to do (once you know its there!)

Thanks for sharing!

You might find some useful hints here: https://social.technet.microsoft.com/Forums/en-US/7ec64d6d-c3fc-4110-94c7-2e0087171475/how-to-remove...

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.