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
m_alireza
Solution Specialist
Solution Specialist

Adding extra spaces to end of value

Hi All, 

I am trying to add extra spaces and a dot to the end of my values in my column. It seems to work in Power Query but when I add it onto a table, Power BI is not honouring it...

For example, lets say I have a table with a column called Fruit. I want the values in there to have around 20 spaces (doesnt have to be exactly 20, just a good amount of spaces) after the text followed by a ".". See sample table/expected output below:

Sample table

FruitExpected Output
AppleApple               .
OrangeOrange             .
KiwiKiwi                  .


I tried using this formula in Power Query and it works when the editor is open:

= Table.AddColumn(#"Changed Type", "Fruit_Padded", each Text.PadEnd([Fruit],20) & ".")

power query space.png
but when i try to put it in a table, it doesnt work anymore. the "." is placed right after the word (although when i hover over it, I can see the spaces)
pbi desktop no space.png

Is there a way to fix this? 

Appreciate your help. 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@m_alireza Use this:

= Table.AddColumn(#"Changed Type", "Fruit Padded", each Text.PadEnd([Fruit],20,Character.FromNumber(160)) & ".")

@ 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...

View solution in original post

2 REPLIES 2
m_alireza
Solution Specialist
Solution Specialist

@Greg_Deckler , thank you!

Greg_Deckler
Super User
Super User

@m_alireza Use this:

= Table.AddColumn(#"Changed Type", "Fruit Padded", each Text.PadEnd([Fruit],20,Character.FromNumber(160)) & ".")

@ 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...

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.