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
twofingertyper
Helper III
Helper III

Two tables, differing data - merge, append new or other?

Hi all, 


I have two tables - one that runs for a longer period (AllSales) and one that is shorter, but captures cancelled sales (SalesStatus). 

They do not have identical columns, but both have a SalesOwnerID that can be used to pair things up. 

My question is how would I pull ALL SalesOwnerID (both historic sales, and those that have been cancelled) so I can review and perform calculations on them? 

 

I thought about appending, but that leaves rows with lots of null values (and as the tables combined are 1m rows plus it's rather data heavy), or carrying out a merge, but if I merge on SalesOwnerID I am still not getting all of the sales through for some reason. 

 

For example:

All Sales has

SalesOwnerIDDateStatusValueProductIDUniqueID
00112/02/24Complete40001120224-001-001
00212/03/24Complete5001130324-002-001
00115/03/24Dispatched 20001150324-001-001

 

SalesStatus has:

SalesOwnerIDDateStatusProductIDUniqueID
00113/02/24Cancelled001130224-001-001
00110/10/24Pending001101024-001-001
00115/03/24Dispatched 001150324-001-001

 

I would like the end result to be simply for SalesOwner 001

SalesOwnerIDDateStatusValueProductIDUniqueID
00112/02/24Complete40001120224-001-001
00113/02/24Cancelled 001130224-001-001
00115/03/24Dispatched 20001150324-001-001
00110/10/24Pending 001101024-001-001

 

If I merge on SalesOwnerID it's not adding in new rows for that ID, and if I append into new I end up with numerous rows with blanks included (I could calculate columns but it seems rather resource heavy for something that should be easier). 

 

Is there a simple trick/method I am overlooking?

1 ACCEPTED SOLUTION

let
    Source = #"All Sales" & #"Sales Status",
    #"Grouped Rows" = Table.Group(Source, {"SalesOwnerID", "Date", "Status", "ProductID", "UniqueID"}, {{"Value", each List.Sum([Value]), type nullable number}})
in
    #"Grouped Rows"

 

lbendlin_0-1728679145155.png

 

View solution in original post

8 REPLIES 8
ryan_mayu
Super User
Super User

based on the sample data you provided, what we can do is to append both tables. I don't not understand why end up with numerous rows with blanks? 

maybe you need to update your sample data?





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

Proud to be a Super User!




Sorry - again an issue with being too brief with my data sample and corrected in the above now. 

 

Essentially you may get records that appear in BOTH tables, and in that case the append obviously duplicates records (one with, one without value). 


The actual data is years of history so I need to keep transformations as light as possible. 

Still not enough data to disambiguate. You will need to know which order a cancellation is for.

Then we can add in a uniqueID from the fields present, due to the nature of the sales someone cannot have a successful and cancelled order in the same day - so there will only be one status per day and any totals for a day (where there's a matching salesowner and productID) can be rolled up into one. 

 

My issue is that I currently try to append the two tables and get a result that produces duplicate lines as opposed to merging everything into a single row.  

let
    Source = #"All Sales" & #"Sales Status",
    #"Grouped Rows" = Table.Group(Source, {"SalesOwnerID", "Date", "Status", "ProductID", "UniqueID"}, {{"Value", each List.Sum([Value]), type nullable number}})
in
    #"Grouped Rows"

 

lbendlin_0-1728679145155.png

 

Thanks - that works, I did wonder about the impact of grouping larger data chunks, but this will work for now I think. 

lbendlin
Super User
Super User

Your data is ambiguous as you don't know for sure what the cancellation is for.  At a minimum you need to add an order ID column.

Sorry! There is a productid associated too (amongst other things) - I was just trying to get across my data without it being overkill. 

Let's just assume that all orders above are for the same product. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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