• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Subcategory in same column need to be split in powerquery

s2310

New Member
Customer and items sold in same column need to made into usable table format.
Please see attached excel file to understand the question.
Please help solve this.
 

Attachments

  • Book 2.xlsx
    9.8 KB · Views: 3
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Invoice No.", type text}, {"Sales", type text}, {"quantity", Int64.Type}, {"rate", type number}, {"Total", type number}}),
    #"Filled Down" = Table.FillDown(#"Changed Type",{"Invoice No."}),
    #"Added Custom" = Table.AddColumn(#"Filled Down", "Customer", each if Text.Contains([Sales],"Customer") then [Sales] else null),
    #"Filled Down1" = Table.FillDown(#"Added Custom",{"Customer"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Filled Down1",{"Invoice No.", "Customer", "Sales", "quantity", "rate", "Total"}),
    #"Filtered Rows" = Table.SelectRows(#"Reordered Columns", each not Text.StartsWith([Sales], "Customer"))
in
    #"Filtered Rows"
 

Attachments

  • Book 2.xlsx
    19.2 KB · Views: 5
Table.AddColumn(#"Filled Down", "Customer", each if Text.Contains([Sales],"Customer") then [Sales] else null),

Hello Mr.Alan,

Can you please tell me how to do this step? Is this a written formula or mouse button clicked step.
Please help.

Thankyou.
 
click on Add Column and type the Mcode provided. It is an If-Then-Else statement. It is case sensitive.
 
Back
Top