Forum Discussion

navafolk's avatar
navafolk
Helper IV
5 years ago
Solved

Merging column to current table column (without adding new column)

Hi pros,

I have 2 tables like

- 'Current' table:

NAMECURTYPE
ausdon
beuroff
cjapon

 

- 'New' table:

NAME
a
d
e

 

How could I merge data from 'New'[NAME] to 'Current'[NAME] without adding new column in DAX? Leave other columns of 'Current' blank for those added from 'New' that 'New' does not mention about. For [NAME] appears in both tables, 'Current' table is pioritized. My expected merging would be:

NAMECURTYPE
ausdon
beuroff
cjapon
d  
e  

 

Thank you very much for your help.

  • Hi  navafolk ,

     

    Create a calculated table using below expression:

    Table = 
    var _tab=CALCULATETABLE(VALUES('Current'[NAME]),FILTER('Current','Current'[NAME]<>BLANK()))
    Return
     ADDCOLUMNS(UNION(_tab,EXCEPT(VALUES('New'[NAME]),VALUES('Current'[NAME]))),"CUR",CALCULATE(MAX('Current'[CUR]),FILTER('Current','Current'[NAME]=EARLIER('Current'[NAME]))),"TYPE",CALCULATE(MAX('Current'[TYPE]),FILTER('Current','Current'[NAME]=EARLIER('Current'[NAME]))))

    And you will see:

     

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!

7 Replies