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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors