Topics: 1. (0:00) Introduction. 2. (01:50) Why do we use Power Query? 3. (02:23) What Power Query can do. 4. (03:15) Teaching pedagogy of Mike “excelisfun” Girvin 5. (03:43) What is data analysis? 6. (05:33) Steps in the data analysis process and where Power Query fits in. 7. (08:34) Define Data. 8. (09:25) Default Alignment. 9. (10:16) Number Formatting. 10. (11:38) Data Types and M Code Values. 11. (12:54) Data is NOT Information. 12. (13:16) Define Table. 13. (14:18) What is not a table? 14. (15:43) Copilot & AI and Power Query 15. (17:50) Types of tables. 16. (20:07) Granularity of tables. 17. (21:07) Summary. 18. (21:17) Preview of next video. 19. (21:44) Mike Girvins Power Query Book 20. (22:05) Closing.
0:10 Introduction to Power Query and Data Analysis
5:40 Data Types and Proper Table Structure
12:55 Tables, Records, and Common Data Storage Mistakes
15:48 Fact Tables, Dimension Tables, and Table Granularity
18:50 Summary and Preview of Next Video on Power Query Implementation
This video introduces Power Query as a vital data transformation tool for Excel and Power BI. It outlines the end-to-end data analysis workflow—from requirement gathering to visualization—and emphasizes the necessity of converting raw data into structured \"proper tables\" to ensure accurate reporting and efficient data modeling.
Welcome to a new class here at Excel Is Fun at YouTube.
Yeah, this class is going to be all about Power Query.
And we'll see how to use Power Query
since the tool is the same in both Excel and Power BI Desktop.
Hey, this is Power Query number one.
And this is an introduction to Power Query
and data analysis.
Now, throughout all the videos, you
can always download the files below the video.
Now, as an example, here's our first video.
And below each video, you want to go below the title,
click the More button, and all sorts of good things
are here in the description at the top.
That will be the zip folder you can download.
You download it, then unzip it to get to the files.
Here's the link to the full class.
Now, I'm only filming this first video,
so there's only one video in this class so far.
But I'll post lots more.
Here's the link to my Power Query M code book.
And below each video, there's a time hyperlink table
of contents.
After you watch the video through once,
when you come back and need to reference something,
you just click and jump to that spot.
Not only that, but I add subtitles.
This video has subtitles in 120 languages.
Here's a list.
Now, let's get back to video number one.
And in this video, we're mostly going to go over terminology
and talk about how Power Query fits into the data analysis
process.
Now, over on Topics, here are the topics for this class.
And guess what?
Number one, Why Power Query?
Now, let's go over to the sheet Why Power Query.
And imagine you're given this data.
Now, one, two, three different files,
access database, comma, separated values, text file,
and an Excel file.
And you need to take all three files
and convert them into a single table
that you can use as the source data for a pivot table
or drop it in the data model in Power BI Desktop or Power Pivot.
Now, Power Query comes to the rescue in this case
because what does Power Query do?
Well, it can import data from different data sources,
clean and transform the data in the Power Query editor,
and then load that data to the worksheet as a table
or directly into a pivot table or the data model.
Or sometimes we do connection only
because we just have that query sitting there
that we're going to use later in a different query.
Now, sometimes you actually create the final report
and analytics in Power Query before loading the data
because there are some types of calculations and reports that
are much easier to do with Power Query
than, say, a pivot table, the worksheet, or the data model.
Now, I have on each sheet here all the topics
we're going to cover.
But I actually want to jump over to the PDF notes.
All right, we're here at the top of the PDF notes.
This is a hyperlink table of contents.
And what I want to do is I want to cover
data analysis terminology.
Now, for some of you, you might already know these terms.
It's easy.
But the way I like to teach a class and tell a story
is I like to start at the beginning,
don't leave any details out, and present
the details in the right order.
That makes it easier for you to learn.
All right, let's start off.
Let's click on what is data analysis.
What is data analysis?
Well, first, there are many synonyms for data analysis,
such as data analysis, data analytics, business
intelligence, data science.
But guess what?
Each term has context that prescribes
slightly different details.
But at the heart of each is this definition.
Data analysis equals convert raw data
into useful information for decision makers.
Here's the picture that I always have
in my mind from the very beginning
when I learned data analysis.
Hey, here's data.
We're going to somehow get it to useful information.
Now, alternative definitions.
Hey, convert data into refreshable solutions
that create actionable information.
How about this one?
Create solutions that allow data-driven decision making.
Or create solutions that reveal undiscovered useful trends
and patterns.
In all cases, the goal is to allow decisions
to be made based on data or empirical evidence.
Now, the way I really see data analysis,
or at least what's at the heart of data analysis,
well, there's always the source data
from many different locations.
But then what do you do?
Before you get to the visuals and pivot tables
and dashboards, you have to take that data
and make transformations, perform logical tests,
and mathematical calculations to create proper tables of data,
and then create the final source data model.
Then from that final source data model,
create useful information from that source data model.
Now, let's scroll down to the next page
because we've got to talk about how Power Query fits
into the full data analysis process.
Now, here are the steps in the data analysis process.
Number one is always interview the decision maker
and ask, what information do you need?
What questions do you need answered?
What patterns might you need revealed?
Number two, where's the data?
Sometimes you have to hunt and investigate
to find that source data.
And that data is the data needed to create
the useful information.
Then number three and four, this is where Power Query comes in.
Number three, connect to the data sources.
Clean and transform the data into the structure required
to create the useful information.
Usually that structure is a proper table.
And we'll define exactly what a proper table
is in just a moment.
Then you load the data to the worksheet
as an Excel table directly to the pivot table
or the data model in both Power BI Desktop and Power Pivot
in Excel.
And of course, there's connection only.
Number five, create the data model.
If you're creating a flat table, for example,
for the pivot table tool, well, you already
did that up here in step three and four.
But if you're going to load directly to the data model,
then you create a star schema data model.
And we'll define what that is in a later video.
Then number six, create the useful information.
Excel, pivot tables, charts, and definitely
lots of amazing useful information
is created with worksheet formulas.
A lot of finance and forecasting and mathematical calculations,
that's all done in the worksheet with Excel formulas.
And then, of course, you can create your useful information
in Power BI using interactive visuals and dashboards.
Now, when you create the useful information,
sometimes you actually do it directly in Power Query.
And there's certain reports in analytics
that are much easier to do in Power Query than any
of the other Microsoft tools.
All right, so step six, we just created
our useful information.
That's it, right?
We're done?
Nope, we still have three steps left.
Number seven, we have to review the information
to see if that information is sufficient.
If it's not, then we go to eight.
Get more data if needed.
That means maybe we have to connect to a different data
source and fix the data model if needed.
In either case, whether we connect to a different data
source or change something in the M code in Power Query
or the data model, we can simply refresh our reports
and everything will update.
And then number nine, when the data source we're
connected to, when that updates, we
refresh reports, visuals, and dashboards
any time that new data arrives.
You can also auto-refresh if you're using Power BI
online, for example.
All right, next, we've got to scroll down and talk
about what is data.
We actually got to talk about four different aspects of data.
What's data?
Default alignment.
And when you're in Excel and Power BI visuals,
we've got to talk about number formatting.
And when we're in Power Query, we
got to talk about data types and values.
All right, data, raw data, what is it?
It's data stored in its smallest form in a cell.
Right here, we have three bits of data separated by a comma.
But you can't easily add numbers if you
have numbers in a cell with other data or sort dates.
Now, this is common to get data separated by a comma.
We just split it apart and get one, two, three
individual cells with the bits of data.
This data is easy to use in tables and easy to analyze.
Now, default alignment, this is one of those small details
that most people in the world don't pay attention to.
But it's simple.
It's a visual cue to tell you what sort of data you have.
Text is always aligned to the left by default,
and by default, numbers to the right.
And this helps in two ways.
In Power Query, we often get data imported as text.
So when you see a number aligned to the left,
you know you need to add a data type
to convert it to a real number.
The second benefit of always being aware of default
alignment is when you make a typing error,
this is not a real date, which is really a number.
So Excel, Power BI Desktop, and Power Query, they're polite.
They align it to the left so you know you made an error.
Same with this.
It should be a number aligned to the right,
but we made a typing error.
Now the third important fact about data.
When we're in the Excel worksheet or Power BI Visuals,
number formatting can be applied on top of the number
to display it differently than what the underlying number is.
And this is important because when you have a date,
you may type in 228, 2025, but underneath is a serial number.
That allows you to do date math.
Same with time.
I typed 8 AM into the cell, but underneath, what did Excel do?
It took 8 divided by 24, so 8 as a proportion of a 24-hour day,
and put the number 0.333.
That's so we can do time math.
Similarly, currency format, you may
see the dollar sign sitting there on top of the cell,
but it's not really in the cell.
Now we don't have number formatting in Power Query
Editor, but we do have date and time data types,
and the same exact thing is happening in Power Query.
Now we'll talk all about date and times and things like that,
but number formatting, it's a facade.
It's just how the number is displayed,
and you have to be aware of that because underneath could
be a completely different item, and that underlying item
is what you need to work with with formulas.
The last important point is data types and values.
Now in Power Query, we do not have number formatting.
Instead, we apply data types to values and columns
to create consistent data for data analysis.
At the top of each column, there's a little button,
and when you click, there's a dropdown.
You can select the data type.
Down here, we see ABC.
That's text, so we apply ABC to each one of the text columns.
That way, we can make text calculations on text data.
Here, 1.2, that's decimal.
That means we can make number calculations,
and over here, that means date.
And so data types are very important.
When we transform and clean our data,
we always have to apply the correct data types
so wherever we load the data, we can actually make calculations.
If we left a number field as text,
then when we try to use the SUM function, we'd get 0.
Now we'll study data types and M code values later.
I put a list of all the M code values here.
There are 15 of them and the 20 different data types
that we can apply, but that's for a later video.
Now next, we want to make sure we don't mix up
data and information.
Data, that's all the little bits of raw data.
It hasn't been converted into useful information yet.
When we get to converting into that useful information,
that's the information.
We take data and convert it into information.
Data is not information.
Now let's talk about perhaps the most important topic,
and it's important because defining what a table is,
most people working out in the working world
do not know what a table is.
And I'll show you an example of what a table is
and what it's not.
Now a proper data set, data set table,
it's made up of fields, columns, field names.
Those are the names at the top of the columns and records.
Field names are always in the first row.
These names tell you what type of data go into the column.
And then in all the remaining subsequent rows,
these are called records.
Now in this three column table, each record
represents a sales transaction.
Now this is a one column table.
Yes, you can have one column in a table,
and it contains survey data.
Now the reason that tables are so important
is because basically all the data analysis
tools in the world, from pivot tables to Power Query
to the data model, they all require tables.
Now let's look at what is not a table.
Now we're looking at what is not a table
because most people don't know what a table is,
so they store data in all sorts of different ways.
Sometimes they'll store records in columns.
1, 2, 3, that's a record.
1, 2, 3, that's another record.
It's really hard to analyze a column of records,
whereas if we convert it to a proper table, which
Power Query makes easy, it's easy to sort, count, add,
and do other analytics.
Now as a second example of how people store data
in non-table structure, this is called a cross-tabulated table.
We have a variable at the front of each row, week 1, week 2,
and so on, and we have a sales rep across the columns,
Chantel, Jim, Joe.
And the intersecting value, that's
why it's called a cross-tabulated table, 6, 7, 1.
That should really be one record with the variable sales
rep Joe and the variable week 2.
Now if we look at just the first row here,
that should be four different records.
Well, with Power Query, it's easy.
We use the unpivot feature, and wham,
we take this cross-tabulated table.
There's our four records, another four records,
and so on, and we have our proper data
set, which is easy to analyze.
Now this is the perfect time in the video
to tell you why I'm not going to teach you
how to use Copilot and AI to do Power Query.
Now this example right here, this
is easy to do in Power Query.
I want to jump over to a different Excel file,
and the file is also available to download below the video.
All right, here's the Excel file.
That's the name of the file that you can download.
Here's the data we started with, and we just
need to convert it into a proper table.
Now we haven't learned about Power Query yet.
If you click on the Data ribbon tab, this is all Power Query,
and this is the output.
Now what I want to do is I want to open up the Power Query
editor and look at the query I created
and the one that Copilot created.
And we're going to use the keyboard to open up
the Power Query editor, Alt-F12.
Over on the left, there are two queries.
Here's the one I created.
You can see the output.
Here's the one that Copilot created.
There's the output.
Now let's go back to the one I created.
And over in Applied Steps, you can
see that it took me three different steps
to get to the end result.
If you click on Source, there's the original table.
If you click on the second step that I created, bam,
I did it in one step.
Bad data into a proper table.
Now let's look at Copilot.
Over in Applied Steps, click on Source.
There's the table, and look at this.
One inefficient, unnecessary step after the other.
Way too many steps.
When we get to the end, it finally
did get the right result, but in an inefficient way.
So my job as a teacher is to teach
you to be awesome with Power Query
and the functional language behind Power Query, M code.
So if you do use AI, you can tell when it spits out junk.
So when we talk about using Power Query
to get the correct structure to create our useful information,
we're almost always talking about getting proper tables.
Now let's scroll down.
And on page 12, there's two different types
of tables that we're going to encounter most often,
fact tables and lookup or dimension tables.
Now fact tables are tables that have data to summarize.
Each row is an observation or a measurement.
Here's one, two, three different examples of fact tables.
This fact table contains a sales transaction in each row.
We might want to count salespersons, add units,
or use the product ID to look up down
to a product lookup table or dimension
table to get the price.
Then we can multiply units times price.
Here's another fact table with daily stock values.
We might do a calculation like, hey,
please give me the average Google stock
price over the last five days.
Here's a table with student data,
student ID, student, and class.
We might count how many of a particular student shows up
or what classes they took.
Now these are the fact tables.
They have the data that we want to summarize.
Now often, we'll have what's called a foreign key.
This is the column that allows us to look up
to lookup or dimension tables.
Now lookup and dimension tables will always
have a unique identifier in the first column, product ID.
There can't be duplicates, because if we look something up
and there's duplicates, the formula
doesn't know what to do.
So this is a product lookup table or dimension table.
This table has end of the month as a unique identifier.
We might want to look up month.
And down here is a customer lookup or dimension table.
We look up a customer ID, and we might return name or zip.
Now when we create a flat table, which
we're going to do next video, we'll actually have a fact
table, and we'll look stuff up and bring the attributes over
to the fact table that we need as conditions or criteria
to make our summary calculations.
But later when we study the data model,
we'll have a fact table and then dimension tables
surrounding the fact table, and we'll
use what's called a relationship.
Now that's all the fun stuff to come.
We're just talking about tables here.
Now one last important topic, table granularity.
Yeah, the word grain just means the size
of the detail in the table.
And this matters, because if you have
tables at different granularities or sizes
or grains, it's difficult sometimes
to compare the numbers.
For example, here we have two invoices.
So this fact table is at the transaction invoice line level.
This, however, only has a single invoice.
These numbers are for the whole invoice.
So if we wanted to compare or combine
these numbers and these numbers, we'd
either have to summarize and get this up to the invoice level,
or we'd have to allocate these down to the invoice line level.
And we'll see how to do that in our data modeling process
later.
Here's another example of a different grain.
This table doesn't have daily or even transactional amounts,
so each cost and sales is at the month grain.
Now in this first Power Query video,
we talked a lot about tables and data and data analysis
and Power Query.
Next video, number two, here's the goal for that video.
We'll have a couple of different files,
each with different structures to the table
and also different data.
We'll have to use Power Query to import these,
convert them all into a single table.
We'll load it to the pivot table cache or a pivot table report,
and then we'll create our pivot tables and charts in Excel.
All right, we'll see you next Power Query video.
Now even though the video files and PDF notes
are all free here at YouTube, if you
want to support Excel is Fun at Amazon,
you can get the book if you get it there.
Leave a review.
And if you buy it at MrExcel.com, there's no review,
but I get more of the cut.