Leveraging Excel’s Data Model

~ Excel Tables, Power Query, Power Pivot, and the Data Model ~

Proper Excel solutions start with Excel Tables.  Advanced solutions leverage Power Query to transform the data into something useful.  You could stop there, and use LAMBDA or a series of Dynamic Array Functions, onsheet, to get the results you want, and you could even use a standard Pivot Table, Pivot Charts, and Slicers.  Or you could take the solution to the next level, use the Data Model to deal with BIG Data needs.

 

BIG Data Excel Solutions leverage the Data Model and Power Pivot

~ If you have millions of rows, file sizes in the gigs, then you may want to consider using Excel’s Data Model and Power Pivot, based on Tables and Power Query ~

 

Take the solution to the next level when you are dealing with BIG Data and load the Power Query Data Tables and the PQ Dimension Tables into Excel’s Data Model.  You can then leverage Power Pivot, allowing tens of millions of rows.

*With the Data Model we are still using Excel Tables and Power Query, but we are using those to stage the data for the data model in Excel 365, versus doing Joins in Power Query.

 

BIG Data Expert

The Excel Data Model in Excel 365 is relational in that allows you to work with extremely large datasets based on relationships between the tables and queries.

The Data Model leverages Excel Tables, Power Query, and Power Pivot.

 

 


Excel 365 Data Model, here showing Power Pivot and DAX.

 

 

 


 

Toll-Free: 877.392.3539Irvine, California: 949.612.3366Manhattan, New York: 646.205.3261

Contact us for a Free Consultation Today.

 


 

 

 

BIG Data Needs a Data Model

If you have BIG Data, millions of rows, consider using Excel’s Data Model.  Millions of records are no longer an issue.  Else, SQL Server would be the next application to look at.

 

Else, how would you do it?

 

 

When should we consider using the Data Model

~ Large File Size & Performance ~

Size, the data model works with very large files, with tens of millions of rows.  Excel cannot handle that on its own.

 

 

LARGE input files.

Here one of the input files is literally 11 gigs, an 11-gig csv file.  Microsoft Access databases in comparison max out at 2.09 gigs.

Here the other files are pretty large as well.

 

 

 

Massive Excel files

 

Look at the size of these Excel files.  400,000 MB!  That is way to large.  Way too much for Excel.

Use a database like SQL Server, or use the Data Model in Excel 365.

 


Excel Files using Power Query and massive source files.

 

Experts Tip:  So if you have BIG data, you may want to take a look at the data model in Excel 365.   Leveraging Power Query with Power Pivot, that is how BIG Data is done.  SQL Server or such are also options.  But if you can do it in the data model, that is a lot easier and cheaper.

 

 

 


 

The Data Model Solution – Excel Tables, Power Query, Power Pivot

The Excel Data Model takes your current Power Query based solution, and expands on what is already there.  You use many of the same Tables and Queries in the Data Model that you are already using in Power Query.  Here we make those Tables available to Power Pivot.  There we join the Tables, and the result is a super powerful Power Pivot Table.

DAX is hard, for sure, but did you not at one point say the same things about VBA and Power Query?   If you want easy, use AI.  If you have BIG Data, use DAX.

  1. Excel Tables
  2. Power Query
  3. Data Model
  4. Power Pivot
  5. Dynamic Array Functions
  6. Code

* For most, the Data Model should be used sparingly, as needed, for BIG Data or complex needs.   It is worth learning.  If your repeat client suddenly has gigs of data, and if he wants to work in Excel, how will you help him?  The best way, if you have to stay within Excel, is to use the Data Model.

I put off learning the Data Model, until my client asked for it, then I went over to EOTG to learn all about it.  Then Chandeep. The resources are out there, it does not take long to learn this.  Well, DAX will take some time, but ………

 

I definitely did not want to learn DAX, I am focused on learning M-Code right now.

 

Anyhow, Power Pivot is powerful, and worth looking at, when the need is there.

 

 


 

The Demo Solution

I spent a few hours, created four Excel files, and I created a super simple to understand budget based demo, to show how you would set this up.  It is meant to be simple, so that it is easy to follow.

The demo is all about the components of the solution, and how the data flows, from External data files, into Power Query, and then into Power Pivot.

 

 

The Periods Table in Excel 365

Here we load an Excel Table into Power Query.  We will expand the number of columns in PQ, not onsheet using Excel functions.

We could do this Table Transformation directly in Power Query, which is usually preferred, but we did want to load the Fiscal Year and the Business Days, both which are entered by the user.

So we upload the base Table into Power Query, and we do the rest of the column transformations there, based on the Date attribute.

~ Power Query looks at the User Filter Checkboxes. 

~ The User Filter column allows the user to specify which periods are loaded into PQ.

~ The Budget or Actual column attribute is a function.  This can be used in Headers, by functions, etc.  (This too can be done directly in Power Query, but here, we wanted the user to see it).

 


A Periods Table is very useful in an automated solution. You can load that into the Data Model as a Dates Table.

 

 


Power Query brings in the current period, which is used as a Filter, or used in Joins.

 

Power Query Transforms the Table

Power Query will create Period related columns, simply based on a date attribute.  No need to do this in Excel anymore.

Extracting columns from the Date field is quick.  Month Name, Month Number, Start Date, End Date, Number of Days, Quarter, Week Number, etc.  Very easy to do in Power Query.

 


Load the Periods Table into the Data Model as a Dates Table.  Apply Slicers on this Table’s attributes in Power Pivot.

 

 


 

External Excel Data Tables in Excel 365

This is where a proper Excel solution begins.  Excel starts with Excel Tables.

If you are using Ranges that look like Tables, convert them into an Excel Table.

Here we load 3 Excel Tables into Power Query, where we combine them into one Table.  Now we can reference one Table and not three.  And this approach works well in the Data Model as well.

Data loaded to:  The data Tables are not loaded to a sheet; they are loaded as a Connection Only.   The Table is loaded into the Data Model.  Power Pivot will reference that Table.

Up to this point, nothing is loaded to a sheet.

 

The three external data sources, three Excel workbooks, with a single Excel Table in each.  Each workbook has the same structure.

 

For this demo, we created three external Excel data files, using Excel Tables.

 

 

The External Data Sources – Demo Files


Actual Data in an Excel Table. Loaded into Power Query as a connection only.

 

 


Budget Data in an Excel Table. Loaded into Power Query as a connection only.

 


Forecast Data in an Excel Table. Loaded into Power Query as a connection only.

 

The three Tables/Queries are Appended to one Data Table in Power Query, for the Data Model to use, to create the Power Pivot Tables.

 

 


 

Power Query in Excel 365

Power Query is now a standard in advanced Excel solutions for business.  And for good reason, PQ greatly simplifies Excel programming, and it greatly reduces user effort, vba, and functions.

Right after Excel Tables comes Power Query, long before you touch a function or Pivot Table.

  • Excel Tables are referenced via Power Query.
  • Pivots and Functions reference Power Query Tables.

 


Here we have four Tables/Queries with Financial Data. We append three of those into one Table.

 

 

Power Query and External Data, the Perfect Match

 

 


Power Query makes this easy.

 

 

Like data goes into one vertical data Table ( Budget, Actual, Forecast )

Not everyone would do this, and this might even shock a few people, but it is actually a smart way to go.  Simplifies formulas, simplified queries, simplifies Pivot Tables.

 

 

Here we appended the Actual, Budget and Forecast data into one Table- it simplifies things

The three Tables have the same structure, same data types. If they are combined into one table, then it is easier to reference that data.

 

 

The Tables in Power Query

Here you can see the data flow, from external data files to the data model.

In Power Query you create the same Joins that you would use in SQL Server or Access.  


Here are the Tables in Power Query.

 

 


 

The Data Model in Excel 365

Currently building this out as I learn DAX.

Currently viewing EOTG course on Power Pivot and DAX.

 


The Tables in the diagram are based on Power Query, they have been added to the Data Model.

 

 

Power Pivot is like a Pivot Table on steroids.  One of the three components in Power BI.

The Joins in the Data Model are One to Many.

 

 

 

 

DAX is not fun.

 

 

More to come on the Data Model as we build out this solution, as I learn DAX.

 

 


 

Toll-Free: 877.392.3539Irvine, California: 949.612.3366Manhattan, New York: 646.205.3261

Contact us for a Free Consultation Today.