cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Nikhil_B
New Member

Word wrap functionality for table values

In Power BI desktop I am using Table visualization to display some text data. However the text in one of the columns is too long to fit in the column width ,so the text does not get displayed completely and ellipsis (...) is displayed.
I serached formatting options for word wrap functionality but could not find any option to word wrap the values. Though there is an option to word wrap the column headers.
Please share any ideas.

 

9 REPLIES 9
Anonymous
Not applicable

Get into the Formatting Tab of the Table and select Values->Word-Wrap >toggle on /off as of your requirement

efglynn
Advocate IV
Advocate IV

The video "Power BI Desktop Update - May 2017" published on May 2 shows at ~1:45 that Power BI Desktop has word wrap for values in addition to headers, but it's missing in my updated version.  Word wrap only works for headers now, not values.

https://www.youtube.com/watch?v=CKISVNHcHVA&feature=youtu.be&t=20s

I have the same issue. Although it is said that there is word wrap for tables in may 2017 update. My version Version: 2.46.4732.721 64-bit (may of 2017) does not.

Along with the standard table/matrix, you will see on the bottom right a table/matrix preview. You ought to use these for the word-wrapping functionality.  Once selected, you can go into the Style 'roller icon' and turn on word wrapping. Finally, just drag the columns on the visual closer together and the text will wrap.

 

 

Thanks! Just figured it out I had to enable it in File/Options and Settings/Options/Preview fetures.

 

Greetings

MarcelBeug
Community Champion
Community Champion

You can ue the Power Query function below. It will split TextString in a list with a maximum of LineLength positions,

Let's call it TextWrap.

 

= TextWrap("Word wrap functionality for table values",20)

 

gives you

 

Word wrap
functionality for
table values

 

If you want the result in 1 field you can use Text.Combine:

 

= Text.Combine(TextWrap("Word wrap functionality for table values",20),"#(cr)#(lf)")

 

 

(TextString as text, LineLength as number) as list =>
    List.Generate(() => 
 
           [TextPart      = if Text.Length(TextString) <= LineLength
                            then TextString 
                            else if Text.PositionOf(Text.Start(TextString,LineLength + 1)," ",Occurrence.Last) > -1
                                 then Text.Start(TextString,List.Min({LineLength + 1,Text.PositionOf(Text.Start(TextString,LineLength + 1)," ",Occurrence.Last)}))
                                 else Text.Start(TextString,List.Min({LineLength,Text.Length(TextString)})),
            RemainingText = if Text.Length(TextString) <= LineLength
                            then "" 
                            else if Text.PositionOf(TextPart," ") > -1 
                                 then Text.Trim(Text.End(TextString,Text.Length(TextString)-Text.Length(TextPart)-1))
                                 else Text.Trim(Text.End(TextString,Text.Length(TextString)-Text.Length(TextPart)))],

            each Text.Length([TextPart])>0,

            each [TextPart      = if Text.Length([RemainingText]) <= LineLength
                                  then [RemainingText]
                                  else if Text.PositionOf(Text.Start([RemainingText],LineLength + 1)," ",Occurrence.Last) > -1
                                       then Text.Start([RemainingText],List.Min({LineLength + 1,Text.PositionOf(Text.Start([RemainingText],LineLength + 1)," ",Occurrence.Last)}))
                                       else Text.Start([RemainingText],List.Min({LineLength,Text.Length([RemainingText])})),
                  RemainingText = if Text.Length([RemainingText]) <= LineLength
                                  then ""
                                  else if Text.PositionOf(TextPart," ") > -1
                                       then Text.Trim(Text.End([RemainingText],Text.Length([RemainingText])-Text.Length(TextPart)-1))
                                       else Text.Trim(Text.End([RemainingText],Text.Length([RemainingText])-Text.Length(TextPart)))],

            each [TextPart])

 

Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

Re Text.Combine solution: this is a great function but I am struggling to implement it. Firstly, I got null errors - I resolved this with 

try Text.Combine( TextWrap([ManagementComment],20),"#(cr)#(lf)" ) otherwise ""

In the Query Editor, it then appears perfectly. However, when I drag it onto a table visualization it ignores the CRs and LFs. This is clearer in the Data window in Power BI Desktop, It ignores the CRs and LFs, although when you hover over it, it uses them in the box that pops up! 

 

Is there something I am doing wrong?

 

Thanks Marcel.

 

No. I'm afraid it just doesn't work yet in any visuals.

 

The way I use it is to have separate rows with line numbers (so without the Text.Combine), like in my Power Query function dashboard.

 

For example this is the helpinfo for Text.Combine in the Query Editor, split in 2 lines:

 

Text Wrap - 1.png

 

This is how it looks like in my dashboard. As you see it includes the line numbers which is not really an optimal solution, but I guess the best possible at this moment.

 

Text Wrap - 2.png

 

 

Specializing in Power Query Formula Language (M)
Anonymous
Not applicable

Thanks - it must just strip CRs and LFs when rendering in the table. I guess we'll just have to wait for Word Wrap on values at some point - I understand it's been promised.

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors