All language subtitles for 9. RUNNING TOTAL

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Now, in the last lecture we discussed about the sum function, or you can say total function.

Now there is another variation of this function.

Through which you can find the running total.

Now, what is running total?

So suppose for see when you have three kinds of order with revenue, 100, 203 hundred.

Now, if you calculate the total, the total will be 600.

But a running total will only add that value and only the values that are above that value.

For example, here in the first row, the revenue is 100.

There is nothing above it, so it will only give 100.

But in the second row the revenue is 200 and there is a revenue of 100 before that.

So the total will be 300 for the third row.

The revenue is 300 and there is already a revenue of 201 hundred above that.

So the running total will be 600.

So running total is calculating the sum up to that point.

Usually running totals are calculated on date values.

For example, you may have heard of terms like year till date or month till date.

Which correspond to total number of sales till that day.

So running total is very useful when we are working with revenues and sales figures.

Now how to calculate running total.

You can do that just by adding order by and to your some function.

So earlier we were only using partition by if we write order by statement as well, the sum function

will calculate the running total.

So when we are finding total sum, we just have to use partition by and it will calculate the total

sum.

If you want to calculate the running total, just add order by with your sum function.

So here in this case, I want my running total to be calculated according to the date.

So you just have to mention ordered by end date.

Now let's go back to our PG admin.

So here in our previous example, we calculated the total sales of each estate.

Now let's calculate the running total of each estate according to the order of date.

The formula will remain the same.

So I will just copy paste it here and then.

And then I'll write some of.

Sales.

Over the partition by will remain the same.

And this time we want to calculate running total according to the order of the order date.

Order by the column name is Order date.

We are using a year of running total year.

If I run this so you will see the difference.

Currently we are only getting total.

I have to put.

When the score.

Let's run this.

You can see that now we are getting the running total.

Our data is ordered by date.

So first we have the Alabama state, for which we have all the orders and the ascending order of order

date.

So this is the order of June 2014.

This the order of May 2014.

Again, you can see that the data is arranged in the ascending order of order date.

Now here we have the running total in the last column.

You can see that for the first order, the sales value was 152.

So the running total is 152.

That is some till this row.

For the second row, the sales is 180.

And the running total is 333.

That is 183.93 plus one 52.64.

So this is the sum of these two values.

Similarly, 1053 is the sum of these three values.

1555 is the sum of these four values and so on.

This will go on till we reach the last value of Alabama.

So if I come here So this is the last value.

Just before that, the running total was 31034.

In the next row, the value was 4.36.

So the running total in the last value is 31038, which is equal to the total value of the sales.

So if you sum all the values till here, this is the sum.

You can also see that in the sales total we are getting the same value.

So running total will calculate the total step by step.

Now.

After Alabama.

We have the data of Arizona State here since we have used partition by state.

The running total will start from zero and it will calculate the running total.

As we have discussed previously and for the last value of Arizona.

Also, the total will be equal to the sales total that we are getting in this column.

You can see that for the last value, the total and the running total is same.

So that's the variation of some function with or without order keyword.

If you use order, you will get the same value in your partition and that will be the total value.

If you are using order by in your sum function, then you will get the running total.

As we have seen here.

That's all for this video.

Thank you.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.