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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
PowerBI_Consult
Frequent Visitor

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
Responsive Resident
Responsive Resident

Hi @PowerBI_Consult 

 

  • 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

View solution in original post

dufoq3
Super User
Super User

Hi @PowerBI_Consult, 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 @PowerBI_Consult, 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
Responsive Resident
Responsive Resident

Hi @PowerBI_Consult 

 

  • 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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors