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

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
Raul
Post Patron
Post Patron

Power Query Column

Hi community!

I am trying to create in Power Query 3 columns for an imported text file which gives me this result:

Column1Column2Column3
Local1  
 84555600 
  1
 84333500 
  1
Local2  
 84500500 
  2
 84300300 
  1
 84200200 
  3
 84600600 
  1
------------

 

And I want it to be shown in this way:

LocalsCodItemQty
Local1845556001
Local1843335001
Local2845005002
Local2843003001
Local2842002003
Local2846006001

 

How can I create these new columns from existing ones?
Thank you very much for your help.

1 ACCEPTED SOLUTION
selimovd
Most Valuable Professional
Most Valuable Professional

Hey @Raul ,

 

you can get that by a combination of the "Fill" --> "Down" feature and the removal of the additional rows:

selimovd_0-1635794096311.png

 

Check my example, that should explain it to you:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8slPTswxVNJRAqFYnWgQbWFiampqZmCAJAREhghpY2NjU+zSYOOMMIwzMMBQb4RknIGBMR7bjAwMjNCljRHSQIdic2ssAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","",null,Replacer.ReplaceValue,{"Column1", "Column2", "Column3"}),
    #"Added Conditional Column" = Table.AddColumn(#"Replaced Value", "Delte?", each if [Column2] = null and [Column3] = null then "delete" else null),
    #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Column1"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([#"Delte?"] <> "delete")),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Delte?"}),
    #"Filled Down1" = Table.FillDown(#"Removed Columns",{"Column2"}),
    #"Filtered Rows1" = Table.SelectRows(#"Filled Down1", each ([Column3] <> null))
in
    #"Filtered Rows1"

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
selimovd
Most Valuable Professional
Most Valuable Professional

Hey @Raul ,

 

you can get that by a combination of the "Fill" --> "Down" feature and the removal of the additional rows:

selimovd_0-1635794096311.png

 

Check my example, that should explain it to you:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8slPTswxVNJRAqFYnWgQbWFiampqZmCAJAREhghpY2NjU+zSYOOMMIwzMMBQb4RknIGBMR7bjAwMjNCljRHSQIdic2ssAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","",null,Replacer.ReplaceValue,{"Column1", "Column2", "Column3"}),
    #"Added Conditional Column" = Table.AddColumn(#"Replaced Value", "Delte?", each if [Column2] = null and [Column3] = null then "delete" else null),
    #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Column1"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([#"Delte?"] <> "delete")),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Delte?"}),
    #"Filled Down1" = Table.FillDown(#"Removed Columns",{"Column2"}),
    #"Filtered Rows1" = Table.SelectRows(#"Filled Down1", each ([Column3] <> null))
in
    #"Filtered Rows1"

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Great! Works perfectly, thank you very much

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.