Forum Discussion

tmacfrank's avatar
tmacfrank
Frequent Visitor
7 years ago

Merge columns from two tables

Hi,

 

I have two tables A & B.

 

Table A contains 4 columns: "CID", "Primary tag", "Age" & "Sales"

Table B contains 4 columns: "CID", "Digital tag",  "Age"  & "Sales"

 

Two tables share common column CID, each CID is unique. The only difference of two tables is that A contains "Primary tag" but B contains "Digital tag"

 

I want a new table, Table C,

Table C contains 5 columns: "CID", "Primary tag",  "Digital tag", "Age" & "Sales".

 

in other words, I am trying to append "Digital tag" to Table A, or "Primary tag" to table B. 

 

"Merge" under Query editor is not working as each table has over 4 million rows, any  DAX codes I can apply to deliver that?

 

Thanks in advance !!

 

 

 

 

1 Reply

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

    Hi tmacfrank,

     

    Are the values in column CID same in the two tables? Do they have a relationship with each other like one-many, one-one or many-one? If they have, suppose Table A is on the "one" side, you may create a calculate table using DAX like pattern below:

    Merged Table =
    SUMMARIZE (
        'Merged Table',
        'Table A'[column CID],
        "Primary tag", 'Table A'[Primary tag],
        "Digital tag", RELATED ( 'Table B'[Digital tag] ),
        "Age", 'Table A'[Primary tag],
        "Sales", 'Table A'[Sales]
    )

    Regards,

    Jimmy Tao