Data Model relationship not considered. Why

minimaster

New Member
Joined
Jul 28, 2011
Messages
27
Two tables are loaded to the Data model and a relationship has been created for the Name column. In the pivot the value sum always show the total value of all names in the Name-Value table and the relationships with the 1st table is being ignored. Why is this and how can we adjust to respect the relationship between the two tables?

Data Model Problem.xlsx
ABCDEFGHIJK
1NameDateLocationNameValueSum of ValueColumn Labels
2A01/01/2020HamburgA4Row Labels01/01/202001/04/2020Grand Total
3B01/01/2020HamburgB9Berlin
4C01/01/2020BerlinC13B7171
5D01/01/2020BerlinD3C7171
6E01/01/2020ParisE15D7171
7F01/01/2020ParisF27E7171
8A01/04/2020ParisTotal71F7171
9B01/04/2020BerlinHamburg
10C01/04/2020HamburgA7171
11D01/04/2020HamburgB7171
12E01/04/2020BerlinC7171
13F01/04/2020BerlinD7171
14Paris
15A7171
16E7171
17F7171
18Grand Total717171
Sheet1
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Your data layout doesn't appear to make a lot of sense. How does the 4 for Name A relate to location or date, for example?
 
Upvote 0
Could you show what you want to achieve?

pqpt.png
 
Upvote 0
It makes sense when you like to know how much value was in a location at a certain date. Or?
You've got two different dates and locations for Name A for example. How should the 4 relate to them? 4 for both? Normally the one side of your 1 to many relationship would not contain the values.
 
Upvote 0
Sandy666, your pivot shows the desired result. I know it is achievable with a lookup in the table with the dates/locations, or with a table constructed with Power Query. That works I know. The question is why does this not work within the Data model and setting up relationships
 
Upvote 0
It's basic star schema design - dimension vs fact tables. Relationships in the data model are more about the context in which filters are propagated rather than relationships as you might think of them from databases (SQL, Access etc). If you used the Name field from the second table in your pivot, you would see the values you want, but they would appear the same regardless of location or date as those filters are not propagated to the table you are using for the values.

I've never been terribly good at explaining this (which probably means I don't really understand it) so hopefully someone else will chime in with a clearer explanation!
 
Upvote 0
Sandy666, your pivot shows the desired result. I know it is achievable with a lookup in the table with the dates/locations, or with a table constructed with Power Query. That works I know. The question is why does this not work within the Data model and setting up relationships
that is why there is Power Query
 
Upvote 0
Ok thank you both. Conclusion: When using the Excel data model any data values that should be used for aggregations must be in the "many" table.
 
Upvote 0

Forum statistics

Threads
1,223,786
Messages
6,174,551
Members
452,572
Latest member
KP53

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