Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

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:

 

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

  • 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]​

     

     

    Hope this helps

    Joe

     

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

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

2 Replies

  • 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]​

     

     

    Hope this helps

    Joe

     

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

  • dufoq3's avatar
    dufoq3
    Community Champion

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