# OLAP Pivot Tables

### #1 JPK1066

JPK1066

• Members
• 101 posts

Posted 05 June 2016 - 06:23 PM

I would first like to reiterate that I find Excel Central a wonderful site and extremely useful.

I have a workbook that has many worksheets that get updated every day. I would like to establish an OLAP Pivot Table within the WB. The greatest commonality between the WS's is the date of the data entries.

1)  I would like to pivot fields from different WS's that contain entries with the same date. Can I use a date field as the Primary Key ID? Use the same date in the other WS's as the Foreign Key ID?

2) The WS's are of a different size in both rows and columns. How does this effect or impede the Pivot Table?

3) Can you establish a relationship between more than 2 WS's so that you may use fields from 3,4 or more WS's?

JPK1066

### #2 Jonathan

Jonathan

• 888 posts

Posted 06 June 2016 - 09:18 PM

Hi JKP1066.

1)  Can I use a date field as the Primary Key ID? Use the same date in the other WS's as the Foreign Key ID?

Yes, but the same rules apply as to any other primary keys so this will only work if the dates are unique to each row in the primary key table. If any of the dates are repeated, the relationship will not work correctly.

You can see a more in-depth explanation of primary keys and their use in relationships in the video lesson: Expert Skills Lesson 6-1 Understand primary and foreign keys.

2) The WS's are of a different size in both rows and columns. How does this effect or impede the Pivot Table?

This will not be a problem. Pivot tables are designed to summarize large amounts of data so they can work with any number of rows. Different sets of columns will also be no problem as long as relationships are set up appropriately.

Creating relationships is demonstrated in the video tutorial: Expert Skills Lesson 6-2 Create a simple data model.

3) Can you establish a relationship between more than 2 WS's so that you may use fields from 3,4 or more WS's?

Yes you can, and you can see an in-depth example in the video lesson: Expert Skills Lesson 6-10 Create an OLAP pivot table using a many-to-many relationship.

I hope these are the answers that you are looking for.

Note that if you are trying to consolidate the data from your tables (rather than summarize it), a Pivot Table is not the right tool for the job. If you have Excel 2016, there's now a new Get & Transform tool that enables you to consolidate tables of data and perform many other useful operations. We don't currently have video lessons demonstrating this, but the new Get & Transform features are fully covered in our Excel 2016 Expert Skills book, available from our books page.

Jonathan is part of the professional team who answer Excel-related questions posted on the ExcelCentral.com forums.
Jonathan also tests our courses prior to publication and has worked on all of our ten world bestselling Excel books for Excel 2007, Excel 2010, Excel 2013, Excel 2016 for Windows and Excel 2016 for Apple Mac. Jonathan has also worked on over 850 video lessons for or video courses covering Excel 2007, Excel 2010 and Excel 2013.
As well as extensive Excel knowledge, Jonathan has worked in the IT world for over thirteen years as a programmer, database designer and analyst for some of the world's largest companies.

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users