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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Consolidated table from different sources

Hi All,

 

I have condition to consolidate 2 tables from different sources become one table as in picture.

consolidate table.png

The consolidate table should have latest data so if same UID located must be replace with the newest record from either each table site A or B.

 

Is it possible to apply the condition in Power BI. Highly appreciate for the answer.

 

Thanks & Regards,

Supriatna

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

1) Append both tables

2) Sort by date in descending order and use Table.Buffer to keep the sort order ( https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-in-Power/ba-p/810390 )
3) Check column "UID" and remove duplicates.

 

Removing duplicates should keep the topmost row, so with the sorting before this should achieve what you've requested.

But using Table.Buffer is essential, as otherwise the sort order might not be kept.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

You can follow the below steps to achieve it:

1. Append queries for Site A and Site B table(For example: Site B append to Site A table) in Query Editor

Merge queryMerge query

2. Create 3 measures

A = CALCULATE(MAX('Site A'[Field A]),FILTER('Site A','Site A'[Update Date]=MAX('Site A'[Update Date])))
B = CALCULATE(MAX('Site A'[Field B]),FILTER('Site A','Site A'[Update Date]=MAX('Site A'[Update Date])))
C = CALCULATE(MAX('Site A'[Field C]),FILTER('Site A','Site A'[Update Date]=MAX('Site A'[Update Date])))

3. Create a table visual and drag UID, these new measures and Update Date onto Table visualcreate measures.JPG

Best Regards

Rena

 

 

Greg_Deckler
Community Champion
Community Champion

@Anonymous - Hmm, ugly. @ImkeF any ideas on this one? I could potentially think of a DAX way of doing this but it wouldn't be particularly pretty.

 

You could try merging the tables on UID but give the second table's columns names that identify them as the second table. Create new columns that check which date is newer and then populate these new columns with the correct original columns. Then, select out these new columns as the final table.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hi @Anonymous ,

 

1) Append both tables

2) Sort by date in descending order and use Table.Buffer to keep the sort order ( https://community.powerbi.com/t5/Community-Blog/Bug-warning-for-Table-Sort-and-removing-duplicates-in-Power/ba-p/810390 )
3) Check column "UID" and remove duplicates.

 

Removing duplicates should keep the topmost row, so with the sorting before this should achieve what you've requested.

But using Table.Buffer is essential, as otherwise the sort order might not be kept.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

amitchandak
Super User
Super User

@Anonymous , append and group in power Query

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

https://www.poweredsolutions.co/2019/07/30/grouping-rows-with-power-bi-power-query/

 

 

union and summarize in DAX

summarize(union(siteA,SiteB),UID, "Field A" , max(Table[Field A]), "Field B" , max(Table[Field B]), "Field C" , max(Table[Field C]), "Updated Date" , max(Table[Updated Date]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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