【问题标题】:SAP Export that always change the columns orders and lead to query breaksSAP Export that always change the columns orders and lead to query breaks
【发布时间】:2022-12-02 04:33:38
【问题描述】:

So I have a Query that its source is an SAP exported excel file, problem is that people always export that report using their layouts so exported tables had different column orders and sometimes miss some columns from one person to another so I can't make a unified query source that everyone can work on.

the query act based on only 4 columns from that exported SAP excel and am sure everyone is exporting those columns, However, how can I avoid query breaks and how can I let these people just copy and paste the exported SAP table with wtv. headers order they want without causing any breaks to my query.

【问题讨论】:

    标签: powerquery


    【解决方案1】:

    Set up a query based on a pasted range. From then on, people can just paste over it

    Delete the defaultChanged Typestep that powerquery like to make which looks like

    = Table.TransformColumnTypes(Source,{{"Column1Name", Int64.Type}, {"Column1Name", Int64.Type}, {"c", Int64...
    

    Remove all other columns but your desired four by click selecting them then right-clicking and using remove other columns. That generates:

    = Table.SelectColumns(Source,{"Column1Name", "Column2Name", "Column3Name", "Column4Name"}) 
    

    go from there

    sample full code

    let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Removed Other Columns" = Table.SelectColumns(Source,{"Column1Name", "Column2Name", "Column3Name", "Column4Name"})
    in #"Removed Other Columns"
    

    【讨论】:

    • Hello Sir, So after this line = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], i add next: = Table.SelectColumns(Source,{"Company Code", "Account", "Amount in local currency", "Reference", "User Name"}), am i missing something ?
    • I edited my answer above to provide full sample code. There is no such things as := You cant end with a comma on the last command. you are missing the initial let Source= and the ending in next
    猜你喜欢
    • 2022-12-27
    • 2022-12-27
    • 2022-12-02
    • 2022-12-02
    • 2022-12-01
    • 2022-12-01
    • 1970-01-01
    • 2022-04-20
    • 2022-12-27
    相关资源
    最近更新 更多