Forum Discussion

mtrevisiol's avatar
mtrevisiol
Icon for Helper V rankHelper V
4 years ago
Solved

Combine rows according to a column

Hi everyone,

I've got a table which contains the list of customers of a company:

 

 

Each customer has a code and a name, and some of them change their name over time.

My intent is to create a new table that contains only the most recent names of each customer, so the ideal result would be:

 

 

because client 001 has become 003 and then 006, and client 002 has became 005.

 

How can I do it? This is the pbix file: https://www.dropbox.com/s/z1s9hgw4p5qtrsl/Customers.pbix?dl=0

 

Thanks for the help

 

  • Create a new table like

    Filtered Customers = CALCULATETABLE(
    	Customers,
    	EXCEPT( VALUES( Customers[Code]), VALUES( Customers[OldCode]))
    )

2 Replies

  • Create a new table like

    Filtered Customers = CALCULATETABLE(
    	Customers,
    	EXCEPT( VALUES( Customers[Code]), VALUES( Customers[OldCode]))
    )
    • mtrevisiol's avatar
      mtrevisiol
      Icon for Helper V rankHelper V

      Many thanks, it perfectly works!

      I found that an alternative way consists of a "Right anti" merge between Customers.OldCode on power query