Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Combine two columns into one without repeats

I'm doing an analysis about the schools in the municipality in an excel sheet I have the data of the schools in the initial years and in the other I have the final years. It happens that some schools have only initial years and others only final years, to solve this problem I wanted to create an auxiliary table with the name of all schools and exclude the repeated ones as shown below:

 

Table 1: Columns of school early years

Table 2: Columns of school final years

 

Table that I want to create:

 

 

  • Hi, Anonymous 

    If you want to get the name list of all schools, please try calculated table as below:

    Table = DISTINCT(UNION(VALUES('Early years schools'[School Name]),VALUES('Final years schools'[School Name])))

    or

    Table 2 = DISTINCT(UNION('Early years schools','Final years schools'))

    Best Regards,
    Community Support Team _ Eason

3 Replies

  • Hi,

    In the Query Editor, rename the column heading of one table to exactly match the Other.  Append the 2 tables and the Remove Duplicates.

    Hope this helps.

  • MahyarTF's avatar
    MahyarTF
    Icon for Memorable Member rankMemorable Member

    Hi,

    I my opinion, you need to Alter Clumn name in both table and use same title for both, or add the new column in each table with common name, then Append those an delete other column and also Rmove Duplicated rows :

  • v-easonf-msft's avatar
    v-easonf-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous 

    If you want to get the name list of all schools, please try calculated table as below:

    Table = DISTINCT(UNION(VALUES('Early years schools'[School Name]),VALUES('Final years schools'[School Name])))

    or

    Table 2 = DISTINCT(UNION('Early years schools','Final years schools'))

    Best Regards,
    Community Support Team _ Eason