Forum Discussion

Dhulem's avatar
Dhulem
Regular Visitor
4 years ago
Solved

Copy cell in power query to multiple cells

Hi all, new to power query and ran into a snag. I am trying to copy "Company -- Beta" from the image below for the next 57 cells. Then at cell 58 I have a new company name for example Alpha and then ...
  • v-yalanwu-msft's avatar
    4 years ago

    Hi, Dhulem ;

    You could create a condition column , then use fill down.

    2.fill down then delete original column.

    The final show:

     

    let
    Source = Folder.Files("C:\Users\Administrator\Desktop"),
        #"C:\Users\Administrator\Desktop\_Scrubbed Data xlsx" = Source{[#"Folder Path"="C:\Users\Administrator\Desktop\",Name="Scrubbed Data.xlsx"]}[Content],
        #"Imported Excel Workbook" = Excel.Workbook(#"C:\Users\Administrator\Desktop\_Scrubbed Data xlsx"),
        Sheet1_Sheet = #"Imported Excel Workbook"{[Item="Sheet1",Kind="Sheet"]}[Data],
        #"Added Conditional Column" = Table.AddColumn(Sheet1_Sheet, "Custom", each if [Column1] = "Beta" then [Column1] else if [Column1] = "Alpha" then [Column1] else null),
        #"Promoted Headers" = Table.PromoteHeaders(#"Added Conditional Column", [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Organization", type text}, {"Column2", type text}}),
        #"Filled Down" = Table.FillDown(#"Changed Type",{"Column2"}),
        #"Removed Columns" = Table.RemoveColumns(#"Filled Down",{"Organization"})
    
    in
    #"Removed Columns"

     


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.