+ Reply to Thread
Results 1 to 6 of 6

Data Model Relationships Not working as expected?

  1. #1
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Data Model Relationships Not working as expected?

    I'm getting started trying to understand Data Modeling and Power Pivot more. I'm not sure if it will make things easier in the long run for me or not vs using various Xloopups, Index/Matches, etc but at least trying to start learning it.

    So I have one small table with 3/4 columns in a WorkSheet

    Those are Company Number | Cost Center | Legal Owner | Company Name

    And I copied that data into 2 separate worksheets just deleting 1 column in each. So I have
    In Sheet 1, the first 3 columns
    In Sheet 2, removed Legal Owner and replaced with Company Name

    So Company Number and Cost Center exists in both tables and are identical.

    I then added both Sheet 1 table and Sheet 2 table to the model and created a relationship between the 2 tables using Company Number.

    But in the pivot table, shouldn't I then be able to use the Company Number from Table 1, and get the Company Name from the other table?

    I will sanitize and post a sample soon But is the above steps correct?

    Thanks,
    PT

    EDIT: Sample Attached
    Attached Files Attached Files
    Last edited by ptmuldoon; 12-22-2020 at 02:32 PM.

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Data Model Relationships Not working as expected?

    Because of the direction of the relationship (filter) only go from Table2 to Table1.
    I'm not sure how to edit the relationship in Power Pivot as there is no option to select.

    In Power BI there is an option to select Cardinality to 1:1 and direction to Both.
    Both.png

  3. #3
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Data Model Relationships Not working as expected?

    Thanks,

    I am going to have to try and dig further on the ability to change the cardinality to one to one, but not sure if this is possible.

    It's just that all my reading suggest this should work as expected "out of the box". Both tables have a same/unique identifying column and that the data model should see that automatically without even the need to create a relationship manually.

    Most of the real data for this pulling from online sources, so trying to work it out first with some tiny sample tables.

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,570

    Re: Data Model Relationships Not working as expected?

    If all you do is put the Company Number from Table 1, and the Company Name from the other table in the Rows area then you'll get a complete distinct list of Company Names listed with each Company Number.
    However if you have a value based field, such as Revenue, then when that is added in the Values area the pivot table will only display the rows in which there is a value as modeled.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Data Model Relationships Not working as expected?

    Quote Originally Posted by JeteMc View Post
    If all you do is put the Company Number from Table 1, and the Company Name from the other table in the Rows area then you'll get a complete distinct list of Company Names listed with each Company Number.
    However if you have a value based field, such as Revenue, then when that is added in the Values area the pivot table will only display the rows in which there is a value as modeled.
    Let us know if you have any questions.
    Thanks, I should be able to play and experiment more hopefully this week.

    For my Real data, I will have something like

    Table 1 -> Will have a company number and the revenue and other values.
    Table 2 -> This will have that same company number and then the company names.

    So I'm working to have those Company Names used. Simple Vlookups, Xlookups, index/matches could do all this too. But I know power query and power pivot is the future and time to start learning it.

  6. #6
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Data Model Relationships Not working as expected?

    I'm back trying to understand better how the relationships work in Data Models, I thought this should be working.

    In my model, I have identical tables for Actuals, Budget and Forecast and have tables for each of the last 3 years. Those 9 tables all have the same column fields.

    I then have a separate Divisions table that includes the Company Number, Company Name, City, State, etc.

    And I created a 1 to many relationship between "Company Number" and "SiteTag" to each of the 9 tables. And those columns are text fields in tables.

    Now when I make a Pivot table with that Model, I list Company Name (Division's Table) in rows, and use description (from any table) as a filter. I then try and get the totals for the 'Amt' fields from each table.

    But when I change the description, the totals will only update for that table only. The other table "Amt" fields do not change with it?

    The file of just the model is over 30MB already and to big to share. But below is a screenshot of the relationships.

    I just can't figure out where am I going wrong.

    2021-01-08_15-42-02.png
    Last edited by ptmuldoon; 01-08-2021 at 04:45 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Measure in PVT & DATA MODEL PRESENT but not working
    By EFA10 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-12-2020, 02:23 AM
  2. Power Pivot Relationships between 2 tables not working
    By kjnjanx in forum Excel General
    Replies: 1
    Last Post: 05-14-2019, 04:05 PM
  3. [SOLVED] macro to split data to respective columns not working as expected
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-01-2019, 08:30 AM
  4. [SOLVED] Using VLOOK to Match Data - Not Working As Expected
    By dlc3172 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-26-2018, 10:36 AM
  5. Replies: 0
    Last Post: 10-19-2017, 10:37 AM
  6. Replies: 3
    Last Post: 07-29-2017, 04:32 AM
  7. Replies: 6
    Last Post: 05-07-2012, 10:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1