Joining Many-to-Many Related Tables

cbrown6305

New Member
Joined
Nov 12, 2018
Messages
12
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.
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Watch MrExcel Video

Forum statistics

Threads
1,114,341
Messages
5,547,366
Members
410,789
Latest member
cpolek83
Top