'Is there a way to add line breaks in a string of text in M (Power BI)?
I concatenated four columns using this code (to prevent null values to be linked together) in Power Query (Power BI Desktop):
= Text.Combine(List.Select(
{ [Col1], [Col2], [Col3], [Col4]
}, each _<> "" and _ <> null),"; "))
I was wondering if there is a way to insert a line break instead of the "; " delimiter; that would make my visuals look neater!
Thanks in advance!
Solution 1:[1]
you can use Lines.ToText (https://docs.microsoft.com/en-us/powerquery-m/lines-totext) without the optional lineSeparator.
Solution 2:[2]
Try using "#(lf)" or "#(cr)" in place of "; "
= Table.AddColumn(#"Changed Type", "Custom", each Text.Combine(List.Select({ [Column1], [Column2], [Column3], [Column4]}, each _<> "" and _ <> null),"#(lf)"))
or
= Table.AddColumn(#"Changed Type", "Custom", each Text.Combine(List.Select({ [Column1], [Column2], [Column3], [Column4]}, each _<> "" and _ <> null),"#(cr)"))
Make sure to format the cells back in Excel as Word Wrap
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dario Oddenino |
Solution 2 |