Forum Discussion
Importing Multiple Lines of Text field from SharePoint list
- 10 years ago
There are two solutions to this issue.
I was able to switch the source field in SharePoint to plain text, and in doing so, stopped the additional text from rendering in PowerBI. This is a quick fix solution that solved my immediate need.
However, the other recommended solution posted above is a more robust approach if you need to retain rich text. I can see a scenario where I may want to retain text bullets, so I will experiment with the other approach as a long term fix to evolving my dashboard.
Thank you!!!
Okay - you will need some more steps, but I was able to go from
this:
To This:
Step 1: Replace </p><p> with ; (to add a delimiter between the colors in the same row)
Step 2: Split your column by position 37 to split the div class string from the start of the first color
Step 3: Replace </p></div> with blank
Step 4: Split Coloum by delimiter ;
Step 5: Unpivot the columns containing your text values you want to keep
Step 6: Remove other columns than the column you got from your unpivot
Step 6: Remove dublicates in your remaining column
This is my entire M code: (the source is just to create a table with the 3 values you gave me)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDBOTsksU0jOSSwuto1Rcq0oSS3KS8xxBvEdnZxdDI2MTcDKUiGKCyAc96LU1DyIiH4BFnmnnNJUPNKRqTk5+eXYFOgDXQPhK8XqEHQhyHUgV5LgAtIscDR0MnI2dsEWBM75OflFxYSsiAUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Text = _t]),
#"Replaced Value" = Table.ReplaceValue(Source,"</p><p>",";",Replacer.ReplaceText,{"Text"}),
#"Split Column by Position" = Table.SplitColumn(#"Replaced Value","Text",Splitter.SplitTextByPositions({0, 37}, false),{"Text.1", "Text.2"}),
#"Replaced Value1" = Table.ReplaceValue(#"Split Column by Position","</p></div>","",Replacer.ReplaceText,{"Text.2"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Replaced Value1","Text.2",Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv),{"Text.2.1", "Text.2.2", "Text.2.3"}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Split Column by Delimiter", {"Text.1"}, "Attribute", "Value"),
#"Removed Other Columns" = Table.SelectColumns(#"Unpivoted Columns",{"Value"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Other Columns")
in
#"Removed Duplicates"Sdjensen's approach I think is the correct one. I just wanted to make sure it was clear why you were getting the div tags and other HTML elements in your data: The field that you're pulling from in SharePoint is set as Rich Text.
The original poster mentioned that the other fields came across fine, but the multiple lines of text field did not. It's not because it's multiple lines of text, I suspect, but because the SharePoint column definition is set to allow for Rich Text.
It may be completely out of your control, but if the original form/SharePoint site is something in your control, and if there's not a business need to keep the field as rich text, you might simplify things by modifying the original field.
- Anonymous3 years agoNot applicable
Hi Aaron,
I am facing the same issue but in my case there is a requirement for the field to be rich text as it contains web-links. Is it not possible to have an option in Power BI to convert rich text to plain text? Like a menu option under Transform. I believe it's time for that. Many thanks.
- mzeppieri10 years agoRegular Visitor
I will try this as well. I can control the text setting, and there is no compelling reason for it to be a rich text field. I will change it to plain text and see if that solves the problem, although the other solution posted above is a nice alternative if rich text should prove a requirement.
- mzeppieri10 years agoRegular Visitor
There are two solutions to this issue.
I was able to switch the source field in SharePoint to plain text, and in doing so, stopped the additional text from rendering in PowerBI. This is a quick fix solution that solved my immediate need.
However, the other recommended solution posted above is a more robust approach if you need to retain rich text. I can see a scenario where I may want to retain text bullets, so I will experiment with the other approach as a long term fix to evolving my dashboard.
Thank you!!!
- diverdown19648 years ago
Most Valuable Professional
Hey all - in case anyone comes across this, I want to point out that there are some easier ways to handle this now. I've written it up in a blog post here - https://whitepages.unlimitedviz.com/2018/04/power-bi-report-rich-text-sharepoint/