0% found this document useful (0 votes)
14 views20 pages

CT7 1

Computer

Uploaded by

La Arriveder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views20 pages

CT7 1

Computer

Uploaded by

La Arriveder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

CT7-1

2024.05.29 수 오전 9:22 ・ 83 분 29 초
송인영

The file that we will use to connect to this new data set.
We shall go through again the connection because it goes too fast lack sign and so I want to replicate
that but please be ready as we have a lot of things to do.
So two, three minutes we start

now first of all, we want to connect to a new data set write a pretty simple measure and then think
about it because we need to

okay so we open an empty pixel file as always, it is completely empty there is nothing in it.
We will use this file to connect to our data set 1 import the data and create our data model and the
table, the power TU table.
So if we follow the usual steps, you will see that in PBI everything will be easier.
This is the last time we used power field from now on at the end of the lecture, we use power VI for the
rest of the course.
Now fire

it's going to connect to data data get data from file from Excel Worklo if you have a different layout, it
might be new, quiting prone work group or whatever.
You need to find these things problems just raise your hand and that will help you.
So you want to get data from this Excel file, which is a more complex file we're starting using now with
more tables you want to locate the file, the data set you want you downloaded

okay so I'm connecting to beta S 1

okay if I can

data set the one. So we are connecting to that set of data is power query connecting to that file we want
to select multiple items and get our one P table sales and four dimensions calendar, customer product
and sales territory.
That's exactly what we did last time but we want to redo that in case you missed anyth

okay now we should transform the data but we don't have time to do that.
We've already seen how we can kill one column or something like that.
We don't have time for this so we go ahead but please do not click load directly because this is Excel.
If you click load, Excel will decide whether to load the tables in classic Excel tables or inside power fields.
So we want to be sure that we give the right instructions.
So I want to select this side arrow you have here and select Load tube

whenever you have this ellipses here that means that Excel is waiting for your input before proceeding.
So we click this load too and now we can say the settings good one These are the set things you want to
cook only create connections.
We don't want any classic Excel tables and load to power people.
Once you click okay now you're loading the data inside the power filler
okay so now the data has been loaded we don't see anything.
The reason is that we didn't load the results into an Excel table.
We loaded them into power tables so there is nothing here.
But if you want to take a look at the data, we could kill the increasing connections.
If you want to rese that you go to Data Queries and Connections.
So with a double crick you can step in power query if you need but we shall not do that.

So in order to see the data, we need to go to take a look at the database.


Is power was already available or is it disabled every time you log out?
So you want to okay I will show you how to re enable them.
So go to the file. If you do it in your computer, it's once in a lifetime but here it's reset every time.
So file options on the left side you could select Adds

and then you select this mana drop down list you select come Adds and now you select go You want to
flag this power fuel for Excel once you flag that, you want to click Okay and the power fuel is already
here Can you notice that's right?
Okay okay now we can go to take a look at the data we loaded through Power Quer.
If you click on Manage Yeah if you click on Manage and not on Health, you take a look at the database
which is behind the curtain.

Okay so here we have our data.


All the tables we decided to load are here like it happened with the data set zero two no difference and
we have our diagram view in order to create the relationships.
The data model we are creating now will be the supplier of the power pivil of the data we shall see now
notice that there is a hidden table on the right.
You want to scroll otherwise you don't see that there is a scroll bar on the bottom.
So I'll put everything in a single screen.

I will magnify now so you can see better one doing and now we need to create the relationships.

Remember that these tables here on top are called dimensions.


They are tables with private key and sales on the contrary is a fact table.
So in general it might not have a primary key.
It is full of foreign keys.
Now calendar, it's connected through the date not date key.
We prefer to use a clear date format.
So date is a real date and we connected with order date in sales for the last.

Okay let me know otherwise.


Please. So date is connected to all the day one to many all the rest we will use the key, the field with the
name key only with the date.
We can do that for a very specific reason you're not I will not have to specify it to work with dates.
The date key here would have been a tax.
So we prefer to work with dates in the case of dates.
For everything else, we use the key customer key connected to the customer key

in sales customer key from customer connected with customer key in sales.
Another one too many connection we go ahead with the product key connected with the product key in
sales

and sales territory key connected to the sales territory key in sales again.
So you see here there is no composite key.
Each table has its own primary key which is the natural situation in case anyway, you don't have this.
Now you know, you can create a composite key like we did in data set future.
Okay so this is the data model that will answer the request of the pillo table.
So we shall ask that power pillo table something that power pub table will drive our request to the data
model.

You get the necessary information and we say fill itself with the data in order to create a power pivot.
Remember, you need to launch the pivot from here.
It doesn't save powered people but if you launch it from classic Excel, you see no data classic Excel
cannot reach this data.
So we need to launch this from within the power fueled window pie table.
And if you want to be sure you didn't get it wrong, it must not ask you where the data is.
It will only ask you where to put the report.

So you can select the existing worksheet if you want click OK.
There will be a pilot table right here.
This is indeed a power pilot and you can see that because all the tables are listed.
Be careful about these details.
If you find yourself for any reason in the active tab, it might be you only see a subset of the fields, those
involved in the appeal table.
So make sure to be here in all whenever we broached it.
If you don't find something typically for some reason you are here

that shows you only the fields already in the people.


If you want to add something else, it's not listed.
Now we want to do slicing by color.
I want to see the number of transactions by color.
Remember the rule we need to put in rows the list of colors and that's okay because it comes from the
color table, which is a dimension.
So if you look for color, you find that product color column and you can put it in rows.
This is indeed the list of the colors that we have in the product table.

Now if there are issues, please raise your hand because if you lose me this lecture, we are really in a bad
situation.
So any problems, please ask me the solution.
Don't disturb your neighbor.
So you are in two not listening and we get a problem.
Yes, I can't even hear you

go for forward in doing what you have just done because it's slowing something but I don't know what it
is.

We launch it and
okay so now we create a measure because we said that in the value section we only put measures
explicitly written in dux and we start with a measure we already discussed Monday the last lecture was
made Monday which is the count world measure.
We want to calculate the number of votes for each color.
So in general the measure is not by color.
It is give me the number of rows of the sales table, which is count rows sales.
Remember this

and now we're slicing by color.


We might be slicing by country.
Remember that one thing is the measure Another thing is the way we slice data okay so the measure it's
by self the magic you can reuse it anywhere you want in this case color by color.
So we create a measure on the cell's table.
Go to Measures New measure select the sales table.
If it's not selected, you can call this transactions and the cold is count roll sales.

It's okay and we have our measures in the field

okay now we need to start understanding a little better what we're seeing and I will do the following.
I will now recall here the code of the measure.

Okay so this is the code of the measure.


The first point is, do we agree that this measure has been calculated for each color?
Therefore it is being calculated 123,456,789 times Okay

how is this number calculated?


This number here the calculation is the following.
There is a filter applied to the product color column for the value black.
Why the product color column?
Because that's the one we put in rows.
So we decided to generate a set of values and each of these values will be applied as a filter to that
column.
Once this filter is applied to the table, the column belongs to in this case product.
I told you the rule is that we need to put columns in rows.

Filters, columns or slices belong in two dimensions with respect to the rule.
So this filter is propagated as I explained on Monday to the sales table.
And now you see how many rows are exposed from the sales table.
The number of rows visible is 9,843 Okay so the code is executed always.
The code that is executed is always that one.
Now we need to start with the first bital question How is it possible that I execute the same code?

I have executed the same code 9 times Why do I get 9 different results?
I execute Crose sales and he gives me 9,843 then I execute again cross sales and I have 3,009,000 V again
30,926, 28,000,919 and so forth.
The code is always count Rose sales.
If I get a different result, something must be changing but the code is always cro Cal.
So what is changing? How is it possible to get different results?
If it's obvious, that's okay certify the obvious with me please.

So we are filtering. So what is changing is the filter supply.


So we are evaluating the same formula in a different filter context.
This filter contact thing.
I started saying that in the first lecture now will become extremely important before defining the filter
context in detail I want to go back to the formula.
Her answer is correct but still she doesn't point to the formula.

So the context is the right one.


But let's go back only to the formula.
What is changing in this count row sales in each execution?

Let us speak about filtering.


Now we know the filters is the problem.
That's okay but let's stick to the code.
Countros is always the same, right?
So what is changing must be what the table sales due to the filters as you said and as she said but in the
code we need to accept the fact that it is impossible to answer the following question.
What is the value of town rose sales?
If I ask you this and you answer, you fail the test because nobody can answer this question

unless I specify what filters are applied to sales.


In fact, you have 9 different results for this expression.
Still with me if I tell you what is the value of control sales when there is a filter on the color from the
body in black, then yes, you can ask me but if I don't specify to you what filters are applied, you cannot
answer.
Therefore, when you write a form in DXS like count Rose sales, you everybody would tend to read that
only as follows

count the rows of the table cells but that's incomplete.


You should read it count the rows of the table cells as it is visible due to the figure.
So the table sales needs to be always interpreted.
The table sales after the filters have been applied I might say no filter at all.
Good the answer is 6,000,398 okay so whenever you reference a table in DX, it's always, it's never the
entire table it's the table as it is filtered

okay okay so that I hope that gives the idea that we need to understand a little better about these filters
because now we will play a little bit in this model.
So let's recap what a filter is.
A filter is a restriction on the values of a column.
You can also say the same thing like a filter is a list of values for that colum.
I can say that the product color needs to be black, blue surg that's a filter.
I allow only three values for that color or I can say a filter is product color equals black

it's still one filter and the values allowed is just one value.
So you can allow all the values.
In that case there is no filter at all or you can unload a subset of the bodies or you can apply one body
that you want and the result would be that there would be no rows.
I can say that the filter needs to be or that the color needs to be orange.
If I apply that filter, the result would be no rows.
So the restriction

should be among the values that the col gives.


Of course, I can impose a different value and get no result.
DX's formulas are evaluated in two different contexts.
Today we started with the first context which is called the filter context.
So now we have to define what a filter context is.
We define what a filter is.
A filter context is a set of filters.

So consider as the list of all the filters that are applied to the model before doing a calculation which is
typically a method one or more methods who create these filters.
We create the filters when we put color in rows.
Again, we asked to generate the list and to apply each value singularly as a filter to that column.
And after that it will go calculating whatever we have in the body section.
So let's try to describe the filter context in correspondence of one color or to the grand total.

Imagine that the filter context is a box, a container.


Each filter is a box in this container.
So let's try to describe for example, the filter complex.
Here we have only one filter and the filter gives one value possible for the column, product column.
So in the correspondence of this context here, the filter context can be seen in this way.
This is the filter context the box there is only one filter for the product color column and the value is only
one available allow, which is black.

This is the filter context in corresponding on that calculation I don't see therefore the cross filters that
are generated due to this because if I select, if I impose that the color is black, I have a filter only on the
product color.
But we know that this generates a cross filter on the product he the primary key that will be translated
into the product key in sales but this is not a direct filter.
So

the relationships propagate filters and cross filters but in the filter context I only see the filters directly
applied to columns.
So this is the only future direct applied to a column in corresponding of the calculation that gives 9,843
as a result.
Now how should I describe the filter context at the grand total with the same technique?

What should be inside of?


Before doing that what if I had black and blue?
I told you that I can also say that the filter to the product color column is for the values of black and blue
well in that case I would have another value here.
Black is one value Blue is another value.
This is still a single filter on a single column but two values are allowed.
We said that a filter
it can be a list of any number of bodies for a certain column.
In this case it would be two bodies but we have one.
So we go back now back to the question.
If I asked you to draw me the filter context at the ground table, what would you draw?
There is the box okay what will you put in?

Is there any specific color selected?


So what is the content? There are two possible options either you tell me all the colors or an equivalent
thing which is, let's say cheaper.
Let me give you this example.
Suppose that we have to I gave this example to the preceding class.
It seems to work so I'll try it with you as well.
So we'll reuse the technique.
Suppose that we want to draw to write a book of an imaginary state where anything is allowed.

In this state in which I am the chief of state you can do whatever you want and I want to write a book
listing everything that is possible to do.
You understand that this list will be pretty long, right?
Maybe it would be an infinite book but there is a way to make this book very short.
Anything is possible it's much shorter and it doesn't need to be updated because if I list all the things you
can do one day you invent a new crazy thing you want to do.
I need to add it to the list.

If I say anything is possible, I don't have to do anything on that anymore.


Therefore at the grand Cal, we don't have all the colors we have no filter at all.
The filter context is empty.
Now don't get confused by this.
I know it's confusing. The more the filter context is populated, the less you see because if you populate
the filter context, it means you insert the filters.
So the more filters I have, the less rows I see.
Does that make sense? The less filters I have, the more I see

in an empty filter context I see everything because there is no restriction in any column.
Okay so in the ground total we say the filter contact is amplitude

Okay so as I told you, there are two contexts.


Now we go to the formulas.
There are two contexts in Duxs.
One is the filter context that we started to understand a little bit.
There is another context called the row context.
We shall discuss that maybe next time.
For the moment we concentrate the future context.
We keep the two things separated.
I'm not sure we can also unite them later.
We don't start from here.
It's confusing
if we can't do it if we cannot, no problem in any case we can or cannot that has no impact on the final
test.
I will not ask you the union of these two things at the final so don't get scared by oh, no, I hope it doesn't
do that.
So I don't have it tested.
The filter context we will link it to the measures for the moment the row context we connected to the
columns.
So for now measures are linked to filters.
Columns are linked to row context.

So measures, filter context, columns, row context.


We shall discuss row context later.
So for the moment, we split the world in two.
In one side we have the reporting side of our record like a pig table here when we go to power via
daston will be a power via visual.
I mean we do a reporting, a graphic, a bar chart, a appeal, whatever we have a report in front of us.
So one world is a reporting world.

So it's the world we are living today.


Now the reporting world consists of a report, a P table or whatever and therefore filters because in pivot
tables you generate filters and calculations.
So we discuss the filters you generate when you put a column in rows.
Therefore we speak about filtered context and we have the entire data model behind our calculations.
What I mean is that when you are in the reporting side here, who is providing data to this horrible
people table

this guy here this guy is giving me data.


So I repeat the site that we are now one world we will define the other world next time is reporting.
So a pivot table for example, therefore filters because you have always something in roves in a pillot so
you generate filters.
Therefore filter context measures the entire data model and relationships.
That's one word. So in the reporting side, we typically speak about measures and therefore filters, filter
context, the entire data model

and filters that propagate through relationships.


We will see that when we go to the columns, it's totally another world and it's absolutely the same thing
an image of it, the opposite or the, I don't forget the English word it will come counterpart.
So let's stay on this side for the moment we get on the world of the reporting.
So measures filters, filter contexts, relationships and the entire data model.

Now how many roles are visible in the sales table under the filter context product color equals black?
I will phrase the question when I have as a filter, product color equals black.
How many rows does the sales table expose?
It's obvious can you please say that?
Okay you have it in front of you and you realize that which is good.
I just wanted to be sure that I was clear.
So this is telling me
how the cells table changes due to the filters.
You can see exactly how many rows are exposed for the calculation in the different filters that we apply.
Now suppose that we get now a question that we need to solve that will imply the usage of different
kind of table functions.
There are two main kinds of functions.
One is the scalar functions.
Up to now we have always used scalar functions.
What is the definition of a scalar function?

It's a function whose output output I didn't say input so we don't care about the input but the output is
a single value.
It can either be a number, a text, a date, a logical value, whatever you want.
A single value example of a scalar function sum another example okay divide is another example.
What about Cros?

Is it still scolored or not?


Definition it returns a single value no Why not where do you see multiple bodies returned by Countrose?
There those are not multiple bodies there.
Countrose is executed 9 times every time it returns a single value.
So count laws is still a scalar function.
It takes a table as inputs of many values but you give a table to count ROS.
It gives you one number, the number of rows.
So also countros is still a scolar function.

All the functions we have done until now are scalar.


There is another kind of function that we will start using in a moment which are payable functions.
Table functions are functions whose output is not a single value, but it's a table.
So these functions take many values as input and generate many values as output.
We will now immediately use one and now go back.
Let's go back to the business games.

We are able with this with this pil table we are now seeing the number of rows of the cells table
therefore the number of transactions by each color.
Now suppose that a question comes from the boss that says well, okay, interesting but now I would like
to see for each color the percentage of transactions that are coming from customers that have boxers as
education.
In the table customers, we have the list of customers

and we have a column called English education.


So each customer has something like bachelor, graduate degree, high school I don't know whatever,
what else they have I don't care.
So there is a column that tells me for each customer the educational level.
Now the boss wants to know for each color the percentage of the transaction of that color that come
from these kind of customers those that are just a bachelor degree which I think is the one that you are
doing

and then there is the Magistralis or whatever it is.


Okay now let me give you a first solution that of course doesn't work but I want to be sure we agree on
the fact that that's not answering the question.
The technique that sometimes I'm offered as a solution are you can choose a slicer, click on the Pwot,
right click show feel list.
Let's look for this bloody English education thing.
If you go to the customer, you see this English location you can right click and select abs slicer.

Okay so we have the possibility now to select bachelors.

Did I? So you see the numbers have changed.


Now these are the transactions color by color due to customers that have a bachelor degree.
Now the question is, am I answering the question yes or no The question was, give me the percentage
color by color of the transaction by customer the dark bats.
Did I answer no I didn. I simply gave the way to know how many transactions are black Buttlers 3000 but
the boss was not asking me for this.

The boss wanted to have the 3000 ratio, the 9,000 and something we were seen before okay can I get
those results with this technique?
The answer is no because now I'm filtering the entire pot table only for batchelor customers.
So I'm losing the total rows of the black color which is 9,000.
Therefore I cannot answer the question in this way.

If it is clear, it should be also clear we need another measure.


We need to generate a measure that would be something like transactions to match our customers.
And the answer to the boss is a divide between this measured and the measured transactions okay so
we need to find a way for example for the 9,000 okay now there are not 9,000 more.
Let's remove the filter for a moment I need to find a way to take.
Let's take for example the black color as an example

I received 9,000 rolls from the context 9,843 rolls.


Those are for sure on black products okay but regarding the customer, is there any selection?
There no selection. So I see all the customers bachelor customers, high degree customers, high school
customers, whatever.
So it's okay to filter on the color but out of the rows that the cells expose me, I need to sub select let's
say a subset of those rows.
What is the characteristic of the subset that I want?

So those rules are for black products but I want to do a further selection, the batcher of customers.
So what I need to do it's okay give me the 9,000 rows.
That's okay I have them they are in the sales table but what I need to do is take each row of the sales
table and check whether the customer has an English education equal to Buchros.
Okay so this time I cannot give to Countros the cells stable because if I need to cancel the cell stable, the
cell stable is filtered only by the color.

So that will include only the selection on the color.


What I want to do is okay, give me those rows but then what I want to do is being able to select out of
those rows only the ones in which the customer number in sales corresponds to a customer number in
customer.
So what I need to do is provide to controls, not a table of the model sales.
I need to take that table, apply a modification to that selecting only a few of those 9,000 rows.
So I need a function that takes these 1000 rows.
A table filters, well, selects only the rows in which the customer is butchers and I need to count the roles
of this new table.
Okay that's why I need that table function.

This function will take the cells table as it is visible.


We will select as juice of these rows that have the characteristics that I have and I will give to count rose
this table.
So count rose is very powerful because it accepts anything that is a table.
So if I have a function that manipulates sales but still generates a table, I can give counsels this function.
The first table function that we study is called filter and we will use it in order to generate this matter.

But before let me define what filter does.

Now filter is a table function and as any function, you can see that as a black box that's an input, a table
and an output another table.
What filter does is it scans the input table by row by row and in each role, it verifies a condition that we
have to specify.
If that condition is met for that row, that row will be in the output.
If that condition is not met, that row will be not in the output payable.
So what do we need to give?
Filter is a table to scan and then a condition to check.
Okay

so the number of rows of the output function will be either equal to the input to the number of rows of
the input function all will be lower.
One will be equal basically one there is no future when the condition is met in any row.
Okay remember that in reality filter doesn't filter to make it very clear.
So Microsoft is really helpful in this.
They should have called it selective.

So don't think about filter like a function that creates a filter like when you put something in rows in a
pivot table, the filter is going robe around a table and selecting the rows that match the condition which
is totally nothing but filtering.
So forget the filter I know the name is horrible.
They should have called it select but they told me, oh, it's already in sequel and I said, big deal you called
it filter and it doesn't filter but what happened?
So

it might also be that the result is an empty function, an empty table.


If I put a condition that is never met in any row, the result will be an empty table in the output.
Generally, the output will be a table with less rows than the in general it might be equal it might be zero
surely, it cannot be bigger.
If you think it's obvious, it is not because the next function we will see will return more rows than the
input but we shall see that in a minute.
So let's try to use this function
in our measure to get the feeling on how to use it and how it works.
Anyway, the output of filter is a table so you can write count rows, filter, a table and a condition because
counts at the end fines itself with filter, which is a table.
So that will work. So let's write the measure which is transactions to bachelor customers.
The name is too long we will do only transactions to batchers.

I cannot write directly sales otherwise I'm just mimicking the transaction form.
This is a table. So that would work perfectly because Crose wants a table but if I do this, I'm giving to
CROS a sales table filtered only by color.
That's not what I want. Of course this will be 9,843 rows if we think about this context here but those
include any customer.
We want to do a selection on the customers.
To do a selection before giving the table to counts, we need to use an external filter condition.

So filter open parenthesis you see that filters is asking for a table and a filter expression, a condition.
Now the table is sales.

What is the condition? The condition is that education is equal to BLS, right?
English education equals to bargels.
Now before writing that, let's try to write something simpler.
Suppose that I want to select only the rows in sales in which what do we have here?
A France type I think okay which the order quantity let's say the order quantity needs to be bigger than
two.
I can look for order quantity.
You see that I see the field sales order quantity

and I can say filter sale cells of the quantity bigger than two Okay so that works and we could close the
palanthas but the condition that we want to impose is not on the order quantity.
In which field do I have to put a condition?
English education? Let's look for this English education.
I can't find it.

Where is this English location column in the customer table?


It's not in the sales table.
So now it seems that well, now how do we do it?
Maybe we could think we're not doing that that we could with some kind of vertical lookup bring the
education from the customer table to sales.
But while we here then I told you we don't want to use stupid vertical locps so we can use relationships.

Relationships are very powerful.


Now imagine to be on one row in sales because filter goes row by row I sell in sales in the table you give.
So I am currently in one row of the sales table.
If I follow the relationship towards the customer table, how many roles I find in the customer table
corresponding to my current roll in sales one or more than one look at the connection only one because
customer is the one side of a one to many relationship.
So for one row in sales,
there is only one row in customer table.
The opposite is not true for each row in customer How many rows we have in sales?
I hope many it's a one too many connection but we are on the many side so it must be possible in fact it
is but I will simply say to the softer listen you are in the room in sales okay follow the relationship

that goes to the customer table that is through the customer number which is unique in the customer
table and give you the blood education level of the unique customer in the current road.
To do this, we need to open to use a information function called related.
So if we type in other words, if, if you want to put a condition through sales on a column on the sales
table you are on, let's say a column on the sales table you don't need anything.
You can type it and that's it.

If you want to iterate a table like S but the condition you want to put it's in a related table in a table that
is connected, you need to use this keyword related.
And now you have the chance to put a condition on columns that belong to another table.

If you open related, you see that now you see all the columns of all the tables.
Are you surprised? Think carefully about that sales is the many side of all the one to many relationships
we have.
So if you are in a single row in sales, you have a single row in customer because in each row itself you
have a single customer and customer is the trial of the customer table.

You have a single row of the product table because in each row in sales there is one product.
The product is the key, the primary key of the product table and also from the calendar.
So in reality the F table can access directly any column of any table.
It's enough that there is a relationship.
So now we can say relation.
We can look for English education.
Now we find it

English education. Now the most important thing is closing in immediately related condition.
So related color closed and now we need to say equals to Baxlors.
Don't forget the S at the end and that's our code

shift. And then you can use tab in order to indent the CRB.
Now here works horribly.
Corbi is much better.

Therefore this is a table but remember that this is still a table.


The filter statement generates a table based on the internal table.
You do a selection You just still have a table typically with less words Camps will simply not do anything
will simply not I mean we will not complain.
It's still a table so Campros will not complain and gives us the result.

Okay and now we have our calculation.

Now how do we answer the boss?


The boss wanted the ratio color by color of the transactions to the batch of customers out of all the
transactions of that color.
So now the problem is solved.
It's a stupid devide. You want to do a device in which the denumerator you have transaction to batters
denominator transactions.
I'm not doing that. We don't have time do it yourself.
It's a simple division. Okay now a question how many rows are exposed by the customer table in this
calculation here

I'll phrase the question how many rows are visible in the cells table when we do that calculation note
wrong answer What are the filters applied to the model?
How many filters do we have in that calculation one or more than one only one and what is the filter?
No, there is no filter with the English education I told you, filter doesn't filter.
I only have a filter on the color.
The only filter applied to the model is product color equals black.

So how many rows are visible when we do that calculation?


31 A2 The sales table exposes how many rows out of those I'll be there in a moment.
Out of those rows that are the ones that are visible in the first calculation we are just taking them.
In the second calculation, we are taking them and we are deciding that we want to take a juice out of
them.
But the number of rows is always and everywhere the one that you see in transactions because
transactions is count rows sales.

So that measure will always give you the number of rows visible of any table under certain fils you have a
question

no filter is not. Filter is not a filter function which is incredibly crazy.


Related is just a way to apply the selection on a table based on a values present in a column of another
table supposing that there is a relationship.
Though if there is no relationship, of course, related cannot work.

Now we try something different.


The question that comes now is the following.
Now I want to see by each color the ratio between the transactions of that color.
So 90,800 to black and 3900 for blue the first numbers in the first column in the FW table out of the
total.
So I want a calculation in which I see, for example, for black, I will see the ratio between 9,843 and 6,000
398.
Am I clear for blue? There will be the ratio between 30,097 0 and always 600,398.

Now this in basic Excel is extremely easy.


Equals click on the cell ratio, click on the other cell but that's Excel 30 years ago only one million rows as
a maximum.
You don't have a distant count.
You have to do vertical lookups 100 times.
So that's not a database it's a Stepy spreadsheet.
Of course, things can be easier in some cases here we cannot reason in this way.
There is no cell here this is a database.
So what should we do in order to do this calculation?

As always, try to reason always the same way.


It's still a ratio. So we need to do a division.
What is the numerator transactions?
So the numerator is fine the denominator is our issue.
Again, what should be the denominator when we do black?
How much 6,000,398? And for the value blue 600,398 and the grand total.
So now we need a crazy measure that in fact we call technical measure that looks wrong

because this measure will give us always the same result in any context because it needs to give us this
denominator.
I call it technical measure because you need to hide it to the customer because if the customer finds it
like it happened to me, it takes the phone and calls you.
Oh, there is a matric that doesn't work.
It's not that it doesn't work it's, you don't understand it so you should not see that.
That's why we call it technical mat.

So now we will create a measure that returns always the total number of rows of the cells table.
In order to do this, we need to use another table function.
In fact, we have an issue.
Now I asked you how many rows are visible under the context of the color equals black because this
should now point to the problem How can I recover 60,398 rows if the filters show me only 9,000 rows In
the example of the product black, I see 9,000 rows 9,800 okay with filter I can reduce that.

It makes sense. I have 9,000.


If I want I can say I don't want all of them but if I only have 9,000, I'm going to get more than that.
It seems that the filters are creating a wall that I cannot overcome.
Now due to this, there is a table function that has been generated exactly for this purpose that ignores
any filter applied to tables.
So this second table function we see is still a table function.
So the input is a table and the output is still a table like filter.

But in this case the relationship between the input table and the output table is the following.
The output table will be the input table evaluated in absence of filters.
I repeat again, I give to this function a table with a filter applied.
This function will return me to the table without any filters.
It will ignore any filter applied to the table in input and provide me always in output the entire table no
matter the filters applied.

This country is called All A, the English World.


Now let's think about the number of rows that are given in input and output.
We said that filter returns the same number of rows as the input or less.
What about all? It returns the same number of rows as the input or more the same number of rows only
when the table is not filtered by itself.
So if I give to all a table that has no filter, all doesn't do anything, it will return the same table.
So the number of rows is identical.
But if I give to all a table filter like in this case all will return more rows than they do because all re trans
me always the cells stable with 60,398 rows.
So now we can use this function is the second table function we know.

So we go to create a new measure we call it all transactions.

It is still a Campros.

Again, I cannot use sales because if I simply say sales, we know what we are doing.
We are recreating the transaction matter and I cannot use filter sales because that would reduce the
rolls.
I don't want to reduce the rolls I want to increase the roads.
So I need to give as input all sales.

Let's check again we are understanding or that I am able to be to explain what I'm wanting to explain.
Let's consider again this context here.
How many roads do I see in this table?
How many B no, no, no in this concept it doesn't depend 9,000 perfect this number but I'm not giving
this to countl.
I'm giving this table to crose How many rolls do I have in this table?
600,398? Very good but remember that the cells table still has 9,843 rows.
It's always the same number of rows in any calculation.

So now we can check the formula the formula works look okay and we get a crazy calculation that can
either seem wrong.

In fact, if you remember when was the time that we had always the same body, try to remember what
happened when we were browsing by sales area we had no relationship between customer and sales.
I brought my cell set and we get always the same amount of cells in each continent.
The problem in that case was that there was no relationship between the tables.
So I was applying a filter on the sales area but this had no impact in sales because there was no
relationship.
So this result

usually it's perceived as wrong because it's the typical result you get when you filter a table you make a
calculation on another table there is no relationship.
So the calculation on the other table is independent on the filter that you do.
If you disconnect the product table from sales, you will see transaction would be always 600,398 but in
that case it's a mistake because I'm not filtering, I'm not using relationship.
In this case that's what I want okay so it looks wrong

and that's why we call it technical matter.


So now if you want to answer the boss, you need to do what operation it's against a divide on the
numerator, get transactions and on the numerator denominator we have all transactions and you get a
percentage that sums up to 100 percent.
Okay so table functions are extremely important because they manipulate table in the way that we want
and they can help us generating
complex output. This is not so complex but we're learning.
So for you, I think it's already pretty complex to understand.
So we need to do some other exercise of to fix these concepts questions because now I will ask you to do
one exercise on your own because I want you to get to the final test that you are warm and prepared.
So first shot overcome the test and you think about something else.
Any questions okay now a task for you

this time I will leave you trying to do that on your own of course in a few minutes.
Then we see the solution and we'll go into the break.
It's also late afternoon so we are all tired.
I understand that. So look at what happened when we went from transactions to all transactions.
Transactions changes in every world color by color all transaction does not and it seems as the total of
the transactions

it has been promoted to be the value everywhere.


Okay we can say that this is the result somehow.
Okay now I want from you a new calculation here they show again always the same value but not this
value but this value.
I want a measure that shows me always 180,144.
In other words, that shows me always the number of transactions to bucher customers no matter the
filter on the color try to translate that into filters.

You want to ignore the filters from the color but you still want to inject the selection on the you can do
that using filter and all is just a way to try to understand how you can use them.
That will help you fixing the concept.
There is always somebody that does it that makes it.
So I'm just waiting a few minutes.
Some of you will get there which is very important.
Then we will do it together.
So please try to solve this for you can name the measure something like all transactions, buchelors

because it's the same value like the old transactions but it's focused on buchers.

And now we're going to break

in a minute I will give you a first hand because I know it's a bit confusing at the beginning and I'll suggest
don't try, don't start from scratch.
There are two measures that are already there either you start from all transactions and you already
have the same value everywhere.
The point is that you need to focus that value only on the BCHS.
That's one approach. Or you can start from the

transactions to butchers which has a different value everywhere but it's already restricted to
transactions.
So it's enough to ignore the filter on the color either way you get to the same result.
I suggest you don't start from scratch.
We don't have to reinvent the wheel every time we did the ready calculations that are similar take one of
those and try to modify them in order to get what you want.
Remember that you need to inject the selection on the customers

but you don't want to start from the sale from the transaction of that particular color.
You always want to start from the total amount of transactions, which means always starting from
600,398 and then inject the selection of the customer.

In my view, it's better to start on the transactions to bers there you just need to ignore the filters on the
sales table and the solution is done.
But a student last year told me that to him starting from all transactions was easier.
So maybe it's easier for you.
I don't know either. I don't care.
The result is what matters.
Each of us reasons in different ways

a couple of minutes and we solve it.


Okay but I would prefer that some one of you tells me that it's done

again. If you start from the transactions to bachelors, you take that code you already have the selection
on the Bacheler customers.
So the only point that you need to do is ignore the filter on the color.
So the filter condition in the measure should be on sales or something else.
If you have a filter on sales, you start from the color black from 9,000 and you go to 3000.
If you start from 300,970 for the blue, you go to 1019 1.
To make it work, you always need to start from 16,000,398 rows.

So take the code of the transaction to Buchers and make sure that filter iterates always the entire sales
table.
What is the function that returns to the entire cell stable?
All so practically I wrote the magic try to fix it yourself.
Instead of going on sails which is filtered by the color, you need to go on a table that doesn't feel that
filter.
So you need to protect sails with something that ignore the filters on the column and you will see that
everything works magically.

If you're done, please let me know dam I will show you the reasoning that you can do.
If you reason in another way that's okay until when you get to the same result.
Let me do the reasoning starting from transactions to bots.

So I will copy the code or transaction to Buchers into another matter.


Transaction to Buchers is this one I will simply copy the code control see and create a new measure with
exactly the same code.
This is the code of transactions to boxers.
I told you that the problem here is just let me just do this.
Okay now if I use this code, why don't I get the result that I want?
Because here take for example, the black context I'm iterating sales and sales is only 9,000 rows.

If I want to get the total, I don't need to iterate only those rows.
I want to iterate all the rows.
So instead of iterating sails that is filtered by color, I need to protect it from the filter on the color.
I want always to start from 60,000 rows.
If you do this slight modification, slight doesn't mean simple I know it's difficult but now this shows
always 60,000 rows.
And when I start from 60,000 rows

and select only the batter of customers, where do we end?


Look at the period here if I start from 60,000, I go to 80,000 and that will be true in every context now
because we are, let's say ignoring anything.
So that's the code to use.
If I take the measure which I think I left the name as measure one, which is a very bad name I will change
the name I call it all transactions Buchlers.

Now I get the correct result.

As I told you, this one way of reasoning is not the only one and I will show you how to reason to get to
the same results starting from the old transaction met book one.
I still haven't saved it.

Okay now how could I have do the reasoning in the other way?
Let me show you how we can reason differently.

This is the final result.


Now suppose that I'm starting now from the old matter count rose all sales if I start from this

OK I don't have the parenthesis.


Of course, if I start from this expression here, I always have 60,000 as a result independently on the color
of the product.
So now the only thing I need to do is saying okay but I want this to be focused only on the customers.
So at the end I need to select out of all the rows only the ones that have the characteristics to be from
customers that are English educated with boxers.
So you see that I'm getting exactly yes

English education equals Bes.


You see we are getting exactly to the same code.
I hope that one of these two ways to say the same thing let's say rank some bell in your brain because it
might be that one reasoning that I did makes no sense for you.
The other one it's easier whatever it is it's okay the important thing you get to the same result.
So please try to do this reasoning to get prepared.
Check the formula. The formula is identical to be four.

What the heck is asking me?


Bottles, filters I need anot to close the camp process question.
We are again in front of the same code you saw before.
Okay so now we're going to break just one second.
I need to give a label to each of these behaviors.
The first behavior is being completely passive against the filters.
Count rose sales. The sales table is not protected by any function.
There is no, all there is no filter to post select Classic behavior filters will do whatever they want on the
cell's table.
Second behavior count rolls filters sales with a condition.
I'm still passive against the filters because the filters will influence the sales table but I take the liberty to
take a subset of the results.
So I'm passed with a selection.
Third behavior now I'm totally indifferent on the filters.
Whatever happens on the filter side, I don't care.

And the 4th behavior is I'm still indifferent on the filters but I apply a selection.
So these four behaviors, it needs to be explicitly clear and if you're speaking now that I'm explaining
them, it's not a good way to do the final test.
But again, I'm not a priest so that's up to you.
15 minutes break we meet again at 10 minutes to 6.

clovanote.naver.com

You might also like