Joining Many-to-Many Related Tables

cbrown6305

New Member
Joined
Nov 12, 2018
Messages
13
Office Version
  1. 2016
Platform
  1. Windows
I have a two separate tables in my datamodel with detailed data: ChargesData and PaymentsData. The tables have common fields (i.e., "Location", "Service", "Payer", "Month of Service", and "Doctor") but those fields have a many-to-many relationship between the tables, so I cannot create relationships between the two. I want to join the datasets together so that I can combine the "Anticipated Collections" from the CHARGES table and "Actual Collections from the PAYMENTS table. I currently achieve this by doing the following:

1. Pivot each table to get all possible combinations of "Location", "Service", "Payer", "Month of Service" and "Doctor".
2. Stack the outputs of each pivot and remove duplicates
3. Add the resulting (summarized) table to the data model as NewTable
4. Create a unique identifier in each of the three tables (ChargesData, PaymentsData, and NewTable) which is a concat of all the above fields
5. Create a one-to-many relationship between the NewTable and both the ChargesData and PaymentsData tables
6. Bring the "Anticipated Collections" and "Actual Collections" into NewTable using a calculated column =CALCULATE(SUM(ChargesData[Anticipated Collections])) and =CALCULATE(SUM(PaymentsData[Anticipated Collections]))

The resulting NewTable is usefully because I can pivot by any of the fields and have Anticipated Collections and Actual Collections in the same pivot table.

My question is: Is there a better way to do this? Not only is this a lot of steps, but creating the NewTable increases the size of the file significantly. It seems like there should be an easier way to connect the two original tables.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top