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
randomUser21
Helper III
Helper III

how can i do \n line break in value name in matrix

Hello everybody ,

 

how can i make a line break without touching the size of the column in a matrix, knowing that i only have values in column ?

like \n

 

everyone can help me ?

thank you

1 ACCEPTED SOLUTION

Hi , @randomUser21 

Thanks for your quick response! According to your description, you want to add \n in the column headers.

I test it in my side , the \n in Power Query Editor will not apply to Desktop.And in my workexperience , i have found no way to realize it in Power Query Editor now.

So you can just only use the UNICHAR to add the \n  in Power BI Desktop.

But also you can not put the measure as the column headers.

For your need , we can add a blank query in Power Query Editor:

vyueyunzhmsft_0-1689582700814.png

And then we can put this M code in "Advanced Editor":

 

let
    Source = Table.ColumnNames(Table),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    #"Converted to Table"

 

 

Then we can get the column headers we need amd we need to apply the data to Desktop:

vyueyunzhmsft_1-1689582740141.png

Then we can add a caluclated column in the table.

 

Column = LEFT([Column1],7) & UNICHAR(10) & MID([Column1] ,8, LEN([Column1])-7)

 

vyueyunzhmsft_2-1689582794234.png

Then we can use this column as the headers and create a measure to return the according value.

 

Measure = IF(MAX('Query1'[Column1] )= "First description" , SUM('Table'[First description]) , SUM('Table'[Second description]))

 

vyueyunzhmsft_3-1689582838433.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

4 REPLIES 4
randomUser21
Helper III
Helper III

hello @v-yueyunzh-msft ,
thank you for your message
sorry I expressed myself badly, I wanted this on the header of the column. in your example it was to make First \n description without modifying the length of the column

Hi , @randomUser21 

Thanks for your quick response! According to your description, you want to add \n in the column headers.

I test it in my side , the \n in Power Query Editor will not apply to Desktop.And in my workexperience , i have found no way to realize it in Power Query Editor now.

So you can just only use the UNICHAR to add the \n  in Power BI Desktop.

But also you can not put the measure as the column headers.

For your need , we can add a blank query in Power Query Editor:

vyueyunzhmsft_0-1689582700814.png

And then we can put this M code in "Advanced Editor":

 

let
    Source = Table.ColumnNames(Table),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
    #"Converted to Table"

 

 

Then we can get the column headers we need amd we need to apply the data to Desktop:

vyueyunzhmsft_1-1689582740141.png

Then we can add a caluclated column in the table.

 

Column = LEFT([Column1],7) & UNICHAR(10) & MID([Column1] ,8, LEN([Column1])-7)

 

vyueyunzhmsft_2-1689582794234.png

Then we can use this column as the headers and create a measure to return the according value.

 

Measure = IF(MAX('Query1'[Column1] )= "First description" , SUM('Table'[First description]) , SUM('Table'[Second description]))

 

vyueyunzhmsft_3-1689582838433.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

thank you

v-yueyunzh-msft
Community Support
Community Support

Hi , @randomUser21 

According to your description, you want to add a \n in the value in Matrix visual.

First for the value in Matrix , we can first check the "Text wrap" in the format pane to open the auto-textwrap for the value.

vyueyunzhmsft_0-1689386145291.png

And if this can not meet your need , we can also use the DAX code(   UNICHAR(10)  ) to add a "\n" for the value.

Measure = LEFT(MAX('Table'[Description]),20) & UNICHAR(10) & MID(MAX('Table'[Description]) ,21, LEN(MAX('Table'[Description]))-20)

 The result is as follows:

vyueyunzhmsft_1-1689386233907.png

For this , you can also refer to:
How to add line breaks in a string of text in DAX measure - Power BI Docs [619f-c5a9-58d-825e]

 

And if i misunderstand your need , you can also share me the sample data and your end result like a tabke format to me so that i can help you better!

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

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!

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.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.