Introduction to Excel 2013 Data Model & Relationships

Posted on July 1st, 2013 in Excel Howtos - 26 comments

Have you ever been in a VLOOKUP hell?

Its what happens when you have to write a lot of vlookup formulas before you can start analyzing your data. Every day, millions of analysts and managers enter VLOOKUP hell and suffer. They connect table 1 with table 2 so that all the data needed for making that pivot report is on one place. If you are one of those, then you are going to love Excel 2013′s data model & relationships feature.

Introduction to Excel 2013 data model & relationships - how to use them?

In simple words, this feature helps you connect one set of data with another set of data so that you can create combined pivot reports.

Practical Example – VLOOKUP hell vs. Data Model heaven

Lets say you are looking sales data for your company. You have transaction data like below.

Example data - Excel 2013 data model & relationships

And you want to find out how many units you are selling by product category and customer’s gender.

Unfortunately, you only have product ID & customer ID.

With VLOOKUP Hell,

  1. You first fetch all the customer and product data and place them in separate ranges.
  2. Then write a vlookup formula to fetch product category, another to fetch customer gender.
  3. Then fill down the formulas for entire list of transactions.
  4. Now make a pivot table.

Assuming you have 30,000 transactions, you have to write 60,000 VLOOKUP formulas to create this one report!!!

With Data Model heaven,

  1. Create relationships between Sales, Products & Customer tables
  2. Create a pivot table

Creating a relationship in Excel 2013 – Step by Step tutorial

  1. Relationship feature in Excel 2013 data ribbon tabFirst set up your data as tables. To create a table, select any cell in range and press CTRL+T. Specify a name for your table from design tab. Read introduction to Excel tables to understand more.
  2. Now, go to data ribbon & click on relationships button.
  3. Click New to create a new relationship.
  4. Select Source table & column name. Map it to target table & column name. It does not matter which order you use here. Excel is smart enough to adjust the relationship.
    Creating a new relationship in Excel 2013 - how to?
  5. Add more relationships as needed.

Using relationships in Pivot reports & analysis

  1. Select any table and insert a pivot table (Insert > Pivot table, more on Pivot tables).
  2. Make sure you check the “Add this data to data model” check box.
    Adding a pivot table with data model in Excel 2013
  3. In your pivot table field list, check “ALL” instead of “ACTIVE” to see all table names.
  4. Select fields from various tables to create a combined pivot report or pivot chart

Example: Category & Gender Sales Report

  1. Add category to row labels
  2. Add gender to column labels
  3. Add quantity to values
  4. and your report is ready!

Example Pivot report made with Excel 2013 data model

Things to keep in mind when you using relationships

  • Same data types in both columns: Columns that you are connecting in both tables should have same data type (ie both numbers or dates or text etc.)
  • One to one or One to many relationships only: Excel 2013 supports only one to many or one to one relationships. That means one of the tables must have no duplicate values on the column you are linking to. (for example products table should not have duplicate product IDs).
  • You can add slicers too: You can slice these pivot tables on any field you want (just like normal pivot tables). For example, you can further slice the above report on customer’s profession or product’s SKU size.

Download Example File

Click here to download Excel 2013 data model demo file. It contains 3 different tables and a combined pivot report (with slicer) to show you what is possible.

Do you use relationships?

Ever since discovering PowerPivot, I kind of stopped using VLOOKUP for most of my own analysis. Now that relationships are part of main Excel functionality in 2013, I am using them even more.

What about you? Are you using relationships & data model in Excel 2013? What cool things are you doing with it? Share your tips with us using comments.

Want even more? Try PowerPivot

If you want even more out of your reports, then try PowerPivot. It is a new feature in Excel 2013 (available as add-in in Excel 2010) that can let you do lots of powerful analysis on massive amounts of data. Here is an introduction to PowerPivot.

 

Your email address is safe with us. Our policies

Written by Chandoo
Tags: , , , , , ,
Home: Chandoo.org Main Page
? Doubt: Ask an Excel Question

26 Responses to “Introduction to Excel 2013 Data Model & Relationships”

  1. Ashish Youngy says:

    Data is Excel 2013 behaves so much like a OLAP cube when using with PivotTables. And this is actually wow. Consider learning not just DAX but MDX too :) Happy Excel

    @Chandoo.. Have a nice and safe time in US. Best Wishes. And when they are publishing your interview in Entrepreneur :)

  2. Buzz says:

    I have been using PowerPivot in Excel 2010. My understanding was (via PowerPivot Pro blog) that Power Pivot would NOT be available in Excel 2013 in all versions; my recollection is that it was only going to be available in certain enterprise subscription editions. Thus, for individual users, it will no longer be available? For that reason I have moved some of my projects to Tableau, and do not expect to upgrade to Excel 2013.
    Can you confirm the availability of Power Pivot for all Excel 2013 users , or will it be restricted and unavailable for some users?

  3. Oz says:

    Just this weekend I upgraded from Home Premium to Professional Plus and spent time with Power View and PowerPivot.

    Up to that point I never saw myself in VLOOKUP Hell, and it may not be going away any time soon. I’m surprised to discover how many of my clients are still on Excel 2003. And then I have Mac users who don’t have a lot of this great stuff available to them at all.

    These are great features and I’m going to dive into the Data Models. Unfortunately, I suspect, for me, the practical use may be limited to blogposts because I can’t teach Power View in my workshops or send a client a spreadsheet that has a Power View in it.

    • thundom says:

      Hi OZ,

      I think the Microsoft would only upgrade the excel to a certain level instead of making it so powerful that it might threat their BI product. You know these “powerful” stuff can be easily done with a entry level crystal reports version.

      Glad to listen to ur opinion on it.

      I spent quite some time and energy on Excel and used it a lot, but now I am focusing energy on BI software like crystal reports.

    • thundom says:

      We both know that based on the technology today. All the time we spend on the Macro and advanced function of Excel can be done easily with other softwares which costs only hundreds of bucks.

      • Hui... says:

        @Thondom
        I don’t think Excel tries to be the solver of all problems
        It is a generic tool
        Which for about 95% of people will do what they want 95% of the time
        There will always be specifics where specific custom software will do better than Excel
        It is the commonness of Excel which means that I can send a model to you and it will work , most of the time, that is its strength, of course combined with its flexility in being able to be adapted to suit most needs

        • thundom says:

          Hi Hui,
          You are right.

          But,

          for the business and individual, who spend too much resource on Excel to meet their BI requirements and other processing requests.

          Should they open their eyes to other ways to do it, in this age? Especially for many people try too much time to process stuff with thousands lines of macro programming.

          It is just as when human being created gun fire, the martial arts would not be that effective.

          Ppl need to be prodent when they choose their solution.

          • Hi guys, I just came across your conversation. I have an example of BI vs. Excel stuff. Here in Russia there is an ERP-system called “1C”. It became a defacto standart for accounting, planning and BI / analytics. It is positioned as a flexible and powerful system and it really is.
            But its reporting abilities aren’t user-friendly (or maybe just not me-friendly).
            Many reports require programming and all those SQL things, so that is common for a company to have a couple of programmers who develop and code those reports.
            So the common solution is to export data to Excel and then process it to be more suitable for further analysis or reporting.
            Well, it’s obviously not a rule of thumb that special BI software can outperform Excel in day-to-day routine.

  4. Tris says:

    Hi Chandoo, thanks for publishing great Excel information. Pardon the ignorance as I havent used Data Model nor PowerPivot. But having seen your video clip on PowerPivot, how does Data Model differ from PowerPivot – the “process” seems familiar? Have a great day! And Excel to new heights! Regards,

  5. Nolberto says:

    Excellent posting, some pride themselves for having sheets with thousands of formulas or complicated formulas, but in the end the important thing is to work as little as possible.

    • Oz says:

      @Nolberto let’s not gloat yet. Some people are forced to have thousands of complicated formulas when they don’t have the fancy tools. I’m sad for the 2003 users who have to use SUMPRODUCT when the rest of us have SUMIFS available.

      In the end, I think the important thing is clean, trustworthy data–however you arrive at it. People survived more than 300 years with slide rules and paper. No PowerPivot for the Wright Brothers.

  6. koi says:

    hi chandoo,

    i added 2 column into sales, 1st column vlookup customer ID to CUST sheet to get the male or female, then 2nd column vlookup Product ID to Product sheet to get the product name, then after that i make pivot table out of sales sheet.

    but then the result is really different from yours

    the purposes is just try to do the vlookup vs add to data model to see if they get same result

    thanks

  7. koi says:

    ups sorry, didnt see that you’re filtering using slicer..then it is good now the result are same with less effort :)

    thanks

  8. SPrasad says:

    Hi Chandoo, .I am interested to know whether we can build a star schema or snow flake data models through relations in Excel? (trying to correlate with Qlikview)

    • Chandoo says:

      Hi there,

      You can create a Star schema for sure. Snow-flake is possible too. As long as all relationships are one to many (or one to one) anything is possible.

  9. Raghavendra Shanbog says:

    Hello ,
    I find this option similar to that of MS Access.
    In MS Access as well we have relationship concept and once you create a relationship, you can start creating number of queries based on that.
    But MS Access is not so user friendly and basically its database. Good that we are getting those options/functions in Excel.
    Thanks for sharing this info.

    Regards,
    Raghavendra Shanbog

  10. What is star schema and snow flake.??? Can we have next article on that if it is useful for us???

  11. Roberto says:

    Hi there, can anyone help? I tried testing this out in Excel using two tables. When I go to the Data tab the Relationships button does not appear at all. I am using Microsoft version 14.0.4760.1000, Microsoft Office Professional Plus 2010. Does this version have this capability? Or is there an add-in required?

  12. […] even a layperson can perform if they have the almighty Excel 2010 and PowerPivot installed. Or Excel 2013′s Data Model, which lets you mash up data from Excel Tables and serve them up directly as PivotTables with not a […]

  13. Chandeep Chhabra says:

    Chandoo/Hui,

    The dates grouping feature does not seem to work in Data Model. Is that true or am I making a mistake somewhere?

Leave a Reply