Forum Discussion

jcastr02's avatar
jcastr02
Post Prodigy
6 years ago
Solved

Combining certain columns from different queries

I have certain columns from 3 different queries where Im asking an NPS Question - 1 table is from 30 day , 1 table is from 60 day, and 1 table is from 90 day.   How can I combine or append these columsn so I can get an overall Rating score, but I'd also like the new rows to be labeled 30,60,90 so I know from which time period it's coming.  

  • Hi, jcastr02 

     

    Based on your description, I created data as follows.

     

    You can click 'Edit Query', go to Query Editor, create a new Query, input the following codes in the 'Advanced Editor'.

     

    let
        Source = Table.Combine({Table.AddColumn(Table1,"From",each "Table1"), Table.AddColumn(#"Table 2","From",each "Table2")})
    in
        Source

     

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

3 Replies

  • rainer1's avatar
    rainer1
    Resolver III

    Hi,

     

    you can achieve this in the query editor.

     

     

     

    First, if you want to have a lable label you have to generate a new column in the queries editor.

     

    Go to the tab Custom Column then in the ribbon click custom Column.

    Specifiy the name of the custom Column. The formula is simple like in the picture. Dont forget the quotes.

     

     

    After you edit your three tables you can do the append of them.

     

    You can find the Append Button under the Home tab in right corner.

     

     

    Click Append Choose  Two or more Tables add them to the left and hit ok.

     

    Now your data is in one Table with a identifier.

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, jcastr02 

     

    Based on your description, I created data as follows.

     

    You can click 'Edit Query', go to Query Editor, create a new Query, input the following codes in the 'Advanced Editor'.

     

    let
        Source = Table.Combine({Table.AddColumn(Table1,"From",each "Table1"), Table.AddColumn(#"Table 2","From",each "Table2")})
    in
        Source

     

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, jcastr02 

     

    If you take the answer of someone, please mark it as the solution to help the other members who have same problems find it more quickly. If not, let me know and I'll try to help you further. Thanks.

     

    Best Regards

    Allan