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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gvg
Post Prodigy
Post Prodigy

How to enter special character in Power BI M

Hi,

 

I need to enter non-breaking space in the middle of text string in M. Haven't found any hints on Google. For example here, how do I change space into non-breaking space:

 

= [Text1] & " " & [Text2]

 

1 ACCEPTED SOLUTION

So for non-breakingspace that would be:

 

[TEXT1] & Character.FromNumber (160) & [TEXT2])

Specializing in Power Query Formula Language (M)

View solution in original post

9 REPLIES 9
Greg_Deckler
Super User
Super User

In general, you can enter special characters like:

 

#(lf)


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler@Rfranca

 

No, this is not line-feed I am trying to insert. I am trying to insert a non-breaking space (160).

Keezz
Regular Visitor

"#(00A0)" 

Rfranca
Resolver IV
Resolver IV

@gvg

 

Hi
 
Does the example below look like a line break?
= [Text1] & "" & [Text2]

 

Because as you wrote it should not stay, but if you are presenting this in a table or matrix the formula will break the line according to the width of the column.

 

The width you can adjust with the same mouse.
Change the field configuration as shown below.

Screen Shot 01-09-18 at 02.21 PM 002.JPGScreen Shot 01-09-18 at 02.24 PM.gif

@gvg

 

Please try and test using it. And please mark the right reply as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.

 

Best Regards,

Rfranca

@Rfranca

 

Using what?  I tried:

 

= [Text1] & #160 & [Text2]

= [Text1] & #(160) & [Text2]

= [Text1] & #("160") & [Text2]

= [Text1] & "#160" & [Text2]

 

Nothing works 😞

Keezz
Regular Visitor

= [Text1] & "#(00A0)" & [Text2]

Hi, 

@gvg @Greg_Deckler

 

 

Use the Character.FromNumber () function and use values from the ASCII table.
In this case the value 10 represents the line break.

Please try and test using it.
[TEXT1] & Character.FromNumber (10) & [TEXT2])

 

Attention, in this example expression we are concatenating text with text, so the field [TEXT1] and [TEXT2] can not be numeric, otherwise you must use the Number.ToText () function for conversion.

 

Please try and test using it. And please mark the right answer as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
 
Best Regards,
Rfranca

So for non-breakingspace that would be:

 

[TEXT1] & Character.FromNumber (160) & [TEXT2])

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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