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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Transform table (fill in when missing the first two characters)

Hi,
In case there are six spaces in the beginning of my column in PowerQuery, I would like to fill them up with the same six characters as in the row above.  Below is an example:

 

PowerBI_Consult_1-1711189540607.png

What would I have to do in PowerQuery to make this happen?
Thank you for your help/feedback.

2 ACCEPTED SOLUTIONS
Joe_Barry
Super User
Super User

Hi @Anonymous 

 

  • Highlight the Column
  • In the Ribbion Add Column > Custom Column and add this 

 

if Text.Contains([Column1] , "-") then Text.BeforeDelimiter([Column1], " -") else null​

 

  • Then Highlight the new Column and go to Transform in the ribbion
  • Click on Fill and choose down. This will fill the values below
  • Add another custom column and add this 

 

if Text.Contains([Column1] , "-") then [Column1] else [Custom] & " - " & [Column1]​

 

Joe_Barry_0-1711192492158.png

 

Hope this helps

Joe

 

If you found my answer helpful and it solved your issue, please accept as solution




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


View solution in original post

dufoq3
Super User
Super User

Hi @Anonymous, do not post same request multiple times please. I've answered here.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

2 REPLIES 2
dufoq3
Super User
Super User

Hi @Anonymous, do not post same request multiple times please. I've answered here.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Joe_Barry
Super User
Super User

Hi @Anonymous 

 

  • Highlight the Column
  • In the Ribbion Add Column > Custom Column and add this 

 

if Text.Contains([Column1] , "-") then Text.BeforeDelimiter([Column1], " -") else null​

 

  • Then Highlight the new Column and go to Transform in the ribbion
  • Click on Fill and choose down. This will fill the values below
  • Add another custom column and add this 

 

if Text.Contains([Column1] , "-") then [Column1] else [Custom] & " - " & [Column1]​

 

Joe_Barry_0-1711192492158.png

 

Hope this helps

Joe

 

If you found my answer helpful and it solved your issue, please accept as solution




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors