Multiple table relationships

denisl

New Member
Joined
Apr 3, 2013
Messages
12
I found powerpivot a couple of days ago and am just getting started using it.

I have 3 csv files that I load into powerpivot.
Here's an example -

main.csv:

Name,Value
A,100
B,200
A,300
B,400
B,500
C,600
C,700
A,800

file1.csv

Name,Value_A
A,1
B,2
C,3

file2.csv

Name,Value_B
A,1000
B,2000
C,3000

I load all three files into power pivot under "get external data - text"
I create the following two relationships:
1. main.csv "Name" to lookup table file1.csv "Name"
2. main.csv "Name" to lookup table file2.csv "Name"

Then I generate the Pivot table and have the 3 data sources to build my pivot table.
I select from main.csv - Name and Value
I select from file1.csv - Value_A
I select from file2.csv - Value_B

The resulting table looks like this:

Row LabelsSum of Value_ASum of Value_BSum of Value
A160001200
B260001100
C360001300

<tbody>
</tbody>


So my question is why does the sum of Value_B add up to the total of all the Value_B numbers in file2.csv? For A it should be 1000, B it should be 2000 and C it should be 3000 - yet it's showing 6000 (the sum of all the Value_B's in file2.csv). The Sum of Value_A and Value is working fine.

This is an example - my actual data is 3 very large CSV files with over 2M rows and about 30 columns.

Thank you
 
Its absolutely not cheating and if the performance of your model is acceptable then it's a good solution.

Creating relationships on calculated columns can cause performance issues with large models but if you don't foresee having to work with massively increased data volumes then I would be inclined to stick with your solution!
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,216,084
Messages
6,128,724
Members
449,465
Latest member
TAKLAM

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