Inserting text manually in a custom column and should be visible on refresh of the report

前端 未结 3 1260
[愿得一人]
[愿得一人] 2020-12-06 23:05

We have a table showing data like OpprId, revenue, area region where table is sorted based on highest revenue. This table was built using power query. Here user wants to add

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 23:41

    Edit 29/11/2016: a video is now available to clarify this solution. The code is a little bit different from the code below; basically it's still the same solution.

    On another forum I answered a similar question. First the input data (first name and last name) was read and output by a Power Query query. A column was added to that output (Age - manually maintained). Now I created a query that reads data from the Input table, left joins it with the Output table and write the results back to the Output table. So the Output table is both input and output from that query.

    let
        Source1 = Excel.CurrentWorkbook(){[Name="Input"]}[Content],
        Typed1 = Table.TransformColumnTypes(Source1,{{"Last Name", type text}, {"First Name", type text}}),
        Source2 = Excel.CurrentWorkbook(){[Name="Output"]}[Content],
        Typed2 = Table.TransformColumnTypes(Source2,{{"Last Name", type text}, {"First Name", type text}, {"Age" , type number}}),
        Renamed2 = Table.RenameColumns(Typed2,{{"Last Name", "Last"}, {"First Name", "First"}}),
        Join1and2 = Table.Join(Typed1,{"Last Name", "First Name"},Renamed2,{"Last", "First"}, JoinKind.LeftOuter),
        Removed = Table.RemoveColumns(Join1and2,{"Last", "First"})
    in
        Removed
    

提交回复
热议问题