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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
varung8899
Helper II
Helper II

Get the newly added, missing and updated records after comparing 2 data tables having same structure

Hi All,

Hope you are doing great. Appreciate if could you please help me in identifying a solution for my simple query. I am new to this tool and am sure you will have a solution for it. I have 2 tables with same structure which contains data for Yesterday and Today. I am trying to identify which rows has been added newly and updated in Todays file compared to yesterdays file. Columns are Date, ID, Status, Team but I am interested only about the ID whose value under Team column gets changed / updated or ID's that are added newly. I have used Left Anti, Right Anti Merge & Append queries to find out the rows that are unique in both the tables. But the problem is that if Yesterdays file has ID=123 & Team =ABC and if todays file has ID=123 & Team=DEF both these rows are populated in the final appended table. I would like to have only the record from Todays file (ID=123 & Team=DEF) which is the updated record and I would like to have the value (Team=ABC) under a new column called Previous Team. For the ID's that are newly added in todays file, previous team column would be blank. There are no relations established between Yesterday, Today, LeftAnti, RightAnti & Appended tables.  I am not sure if thats the way to find the records that are different in these tables. Could you please suggest a solution. Please see tables below.

TABLE1 (YESTERDAY):

IDREQUEST DATESTATUSTEAM
12303-JAN-24DevelopmentABC
45608-APR-23DevelopmentABC
89001-JAN-24DeployedABC

 

TABLE2 (TODAY):

IDREQUEST DATESTATUSTEAM
12303-JAN-24DeployedDEF
45608-APR-23DeployedXYZ
78920-MAY-23DevelopmentABC
89001-JAN-24DeployedABC

 

LEFT ANTI, RIGHT ANTI MERGE using ID , TEAM columns & after APPENDING TABLE OUTPUT :

IDREQUEST DATESTATUSTEAM
12303-JAN-24DevelopmentABC
12303-JAN-24DeployedDEF
45608-APR-23DevelopmentABC
45608-APR-23DeployedXYZ
78920-MAY-23DevelopmentABC

ID 890 is removed since its Team is same in both the tables as desired.

DESIRED OUPUT:

IDREQUEST DATESTATUSTEAMPREVIOUS TEAM
12303-JAN-24DeployedDEFABC
45608-APR-23DeployedXYZABC
78920-MAY-23DevelopmentABC 
1 ACCEPTED SOLUTION

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1707441896978.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
varung8899
Helper II
Helper II

Thansk for your reply Ashish. I can update my query to generate new Report Date column to the tables which will be Yesterdays date In Table 1 and Todays date in Table 2 for all the records thereby populating it to the appended table. Could you please propose a solution based on that ?

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1707441896978.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Sorry for late reply Ashish. Thanks for the solution. You are right and it works as expected.
I made it complicated. 🙂

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish, I would need the records which are unique in yesterdays file but not in todays file as well. Thats the reason I have done Left Anti, Right Anti Merge & Append instead of Left outer. Let me remove the sensitive data and share the PBIX file with you in a while. 

Ashish_Mathur
Super User
Super User

Hi,

Why is there no Report date column in the 2 tables to know which is yesterday's and which is today's table?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.