Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ForrestSunday
New Member

How to merge the Two Columns with two different Tables without getting duplicates.

I have 3 tables.

 

Table One: Old Pack Names and Composition

Old Pack Name   Composition
Pack 1          ABC
Pack 1          BCD
Pack 1          CDE
Pack 1          DEF
Pack 2          ABC
Pack 2          CDE
Pack 2          DEF
Pack W          ABC
Pack W          BCD
Pack W          CDE
Pack W          DEF
Pack W          XZE

Table 2: New Pack Names and Composition

New Pack Name   Composition
New Pack A          ABC
New Pack A          BCD
New Pack A          CDE
New Pack D          ABC
New Pack D          CDE
New Pack D          DEF
New Pack D          GQH
New Pack 1          ABC
New Pack 1          BCD
New Pack 1          CDE
New Pack 1          XZE
New Pack 1          WER
New Pack 1          POU

and Table 3, Which has the respective counterparts from old and new systems.

Old Pack Name   New Pack Name
Pack 1          New Pack A
Pack 2          New Pack D
Pack W          New Pack 1

In order to Present and manage the differences in both the systems I need to present the final data as below,

Old Pack Name   Old Composition Status  New Pack Name   New Composition STATUS
Pack 1          ABC         KEPT            New Pack A          ABC          --
Pack 1          BCD         KEPT            New Pack A          BCD          --
Pack 1          CDE         KEPT            New Pack A          CDE          --
Pack 1          DEF         REMOVED                                 
Pack 2          ABC         KEPT            New Pack D          ABC          --
Pack 2          CDE         REMOVED         New Pack D          CDE          --
Pack 2          DEF         KEPT            New Pack D          DEF          --
                                            New Pack D          GQH         NEW
Pack W          ABC         KEPT            New Pack 1          ABC          --
Pack W          BCD         KEPT            New Pack 1          BCD          --
Pack W          CDE         KEPT            New Pack 1          CDE          --
Pack W          DEF         REMOVED         New Pack 1          XZE          --
Pack W          XZE         KEPT            New Pack 1          WER         NEW
                                            New Pack 1          POU         NEW

Currently I am doing it in excel, using multiple Filter Functions, Vstack, and Hstack,but I am unable to scale this solution for hundreds of Packs. I am trying to do it in Power BI, but after merging and expanding the Old Pack Composition, merging with New Composition (With New Pack Name) gives too many extra rows. I need the Solution in Power Query or Dax.

Currently getting the results like below in Power Query.

 

ForrestSunday_1-1679133290169.png

 

 Is there any way of solving this ?

1 REPLY 1
lbendlin
Super User
Super User

Please explain the logic for the final table. Why is Pack2 CDE removed?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.