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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Macros
Frequent Visitor

Table Merge Logic Question

Hoping that someone may have a suggestion on a table merge question that I'm running into based on how some of our billing is setup. 

 

One table lists the what each of our Invoices contain.  They can be from 1 to n rows.

Table1: InvoiceLines

UnitAmountInvoice
10$   10.00IR222
11$       5.00IR222
10$   20.00IR223
5$   50.00IR224
9$ 100.00IR224
10$   50.00IR224

 

We have a second table that lists when a specific invoice may have been sent.  One invoice may be sent between 1 and n times (such as in the case of a subscription).

Table2:InvoiceRecords

AmountInvioceDate
$     15.00IR2221/15/2019
$     20.00IR2231/20/2019
$   200.00IR2241/21/2019
$     15.00IR2221/30/2019
$   200.00IR2242/1/2019

 

I'm trying to merge the two tables to allow for additional analysis in one of our reports.  The end result of merging the two above would show every sent date with every line that was included on the invoice matched off the Invoice. 

 

MergedTable: Hopeful Result

DateInvoiceUnitAmount
1/15/2019IR22210$   10.00
1/15/2019IR222100$       5.00
1/20/2019IR22310$   20.00
1/21/2019IR2245$   50.00
1/21/2019IR2249$ 100.00
1/21/2019IR22410$   50.00
1/30/2019IR22210$   10.00
1/30/2019IR22211$       5.00
2/1/2019IR2245$   20.00
2/1/2019IR2249$   50.00
2/1/2019IR22410$ 100.00

 

I hope this makes sense.  I've tried the merge queries in the query editor but I can't figure out a way to get them to show correctly.  Thank you in advance!

1 ACCEPTED SOLUTION
HotChilli
Community Champion
Community Champion

I think you can 'Merge as new' on the Invoice.  Use Inner Join.

Expand the InvoiceRecords to bring back the Date.

Re-arrange as required.

There's a 100 in the Units of the desired tabled outcome - is that a mistake?

View solution in original post

2 REPLIES 2
HotChilli
Community Champion
Community Champion

I think you can 'Merge as new' on the Invoice.  Use Inner Join.

Expand the InvoiceRecords to bring back the Date.

Re-arrange as required.

There's a 100 in the Units of the desired tabled outcome - is that a mistake?

Thanks @HotChilli I'll give that a shot.  And yes, you are correct, the $100 was incorrect when making the sample data.  I didn't actually realize that I could expand the columns.  I think that was the key part as it was removing the columns I needed when I tried joining them.

 

I'll try that out and update.  Thanks again!

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors