All language subtitles for 11. Power BI Demo Pivoting & Unpivoting Data

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
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
fr French
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,610 --> 00:00:06,200 OK so by this point you should be pretty comfortable with the basic query editing tools date tools your 2 00:00:06,200 --> 00:00:12,110 text tools your number tools and for the most part they've all been pretty straightforward pretty intuitive 3 00:00:12,110 --> 00:00:12,890 to use. 4 00:00:13,070 --> 00:00:18,530 But there are some pretty interesting maybe not so intuitive tools available in that query editor as 5 00:00:18,530 --> 00:00:18,980 well. 6 00:00:19,130 --> 00:00:24,590 And one thing that I want to cover now is the idea of pivoting and pivoting at table. 7 00:00:24,590 --> 00:00:31,460 So the way I describe it pivoting is kind of just a fancy way to describe the process of turning distinct 8 00:00:31,550 --> 00:00:39,430 row values into columns which is called pivoting or turning columns into rows which is called unpinning. 9 00:00:39,470 --> 00:00:46,010 Now it sounds pretty simple pretty straightforward on the surface but it's actually a little bit tricky 10 00:00:46,100 --> 00:00:48,190 to get a hang of at least it was for me. 11 00:00:48,470 --> 00:00:54,950 So I'm a visual learner and what I'm about to show you is what finally caused it to click for me. 12 00:00:54,950 --> 00:01:01,490 So imagine this simple two column table you've got years in the first column and you got a numerical 13 00:01:01,490 --> 00:01:04,420 field like unit sales in the second column. 14 00:01:04,520 --> 00:01:10,880 If we were to select the year column and pivot this table we would essentially take the year in each 15 00:01:10,880 --> 00:01:13,720 row and turn it into its own column. 16 00:01:13,820 --> 00:01:18,590 So now instead of a row for 1994 we have a column for 1994. 17 00:01:18,590 --> 00:01:21,850 Same goes for 95 96 97 98. 18 00:01:21,890 --> 00:01:28,310 So we basically flipped that table from a vertical format up to a horizontal format. 19 00:01:28,310 --> 00:01:30,590 We've turned rows into columns. 20 00:01:30,590 --> 00:01:36,470 Now on the flip side if we started out with the table in that horizontal format and we selected the 21 00:01:36,470 --> 00:01:42,590 years in the first row we could pivot to transform it into that vertical form. 22 00:01:42,590 --> 00:01:47,930 In other words we take those years which had been columns and transform them into rows. 23 00:01:48,290 --> 00:01:54,890 So my little mental tip here is that I imagine that the table is kind of like on a hinge in that upper 24 00:01:54,890 --> 00:02:02,690 left corner pivoting is like rotating it up from vertical to horizontal and and pivoting is like rotating 25 00:02:02,690 --> 00:02:07,490 down is like rotating it down from horizontal vertical. 26 00:02:07,490 --> 00:02:12,830 Now one thing to note there's another tool in the query they're called transpose and that works in a 27 00:02:12,830 --> 00:02:14,200 really similar way. 28 00:02:14,390 --> 00:02:18,210 But the difference is that it doesn't recognize unique values. 29 00:02:18,500 --> 00:02:23,870 So if you're dealing with a table like the one we're looking at here or we don't have duplicate years 30 00:02:23,870 --> 00:02:28,880 or unit sales pivoting and transposing would yield the exact same result. 31 00:02:28,880 --> 00:02:36,650 But if instead we had two rows of 1994 for instance pivoting would collapse both of those rows into 32 00:02:36,650 --> 00:02:44,120 a single 1994 column while transposing would preserve both versions and keep two separate columns each 33 00:02:44,120 --> 00:02:46,290 with a 1994 header. 34 00:02:46,310 --> 00:02:51,740 So one way to think about it is that transpose is kind of clunkier it's kind of brute force it just 35 00:02:51,740 --> 00:02:55,430 takes the entire table and it just flips it on its side. 36 00:02:55,760 --> 00:03:00,620 So I actually have a little demo file that I'm going to show you because you do have to really see this 37 00:03:00,620 --> 00:03:03,630 happening in real time to understand what's going on. 38 00:03:03,770 --> 00:03:05,430 So let me show you what that looks like. 39 00:03:06,710 --> 00:03:10,120 All right so this file isn't available as part of the Course resources. 40 00:03:10,270 --> 00:03:16,710 So just sit back and follow along for this one going to go ahead and grab my data as the CXXVI and I've 41 00:03:16,720 --> 00:03:25,440 called this file on Pivot demo and I'm going to go ahead and open this up right here in the query editor 42 00:03:26,130 --> 00:03:29,610 and right off the bat you can tell this table is a little funky. 43 00:03:29,610 --> 00:03:31,460 There are some things wrong with this table. 44 00:03:31,710 --> 00:03:37,410 Number one I don't have column headers which is not that surprising the column headers here are actually 45 00:03:37,410 --> 00:03:41,620 years so in power be I took a look at the sample of this table. 46 00:03:41,760 --> 00:03:45,140 It said OK I've got numerical values in each column. 47 00:03:45,220 --> 00:03:50,490 You know I've no way of knowing if that's a year or if it's a similar value to the one in row two or 48 00:03:50,490 --> 00:03:51,210 three. 49 00:03:51,240 --> 00:03:52,350 It's an easy fix. 50 00:03:52,410 --> 00:03:56,010 Just go ahead and click you first row setters and there you go. 51 00:03:56,010 --> 00:03:58,470 Now our years have been promoted to hitters. 52 00:03:58,560 --> 00:04:02,790 So we've made one improvement but this table is still far from ideal. 53 00:04:02,910 --> 00:04:06,720 And what we have here is information about unit sales and revenue. 54 00:04:06,720 --> 00:04:13,960 Got two different metrics broken down by year 94 95 each as columns and as an analyst. 55 00:04:13,980 --> 00:04:19,980 As someone who needs to take this data and interpret it and analyze it and explore it this type of table 56 00:04:19,980 --> 00:04:21,970 format can create a lot of headaches. 57 00:04:22,050 --> 00:04:28,230 Really what we're looking for here is a rectangular table with each dimension or metric as a column 58 00:04:28,650 --> 00:04:30,770 and each observation as a row. 59 00:04:31,020 --> 00:04:38,640 So ideally what I want to transform this table into is a format that has three columns year sales and 60 00:04:38,640 --> 00:04:44,220 revenue that would give me a format that I could take and plug into my model and analyze in any way 61 00:04:44,220 --> 00:04:45,350 that I choose. 62 00:04:45,360 --> 00:04:50,790 So let's see if we can do that with our pivoting and on pivoting tools now first things first I don't 63 00:04:50,790 --> 00:04:57,390 like the fact that I have years in columns so I want to turn these columns into rows and to do that 64 00:04:57,510 --> 00:05:04,440 I'm rotating down from horizontal to vertical or on pivoting so that I can do is go ahead and select 65 00:05:05,250 --> 00:05:13,230 all of my year columns go into transform and then press this and pivot columns button and there you 66 00:05:13,230 --> 00:05:13,560 go. 67 00:05:13,560 --> 00:05:17,780 It's transformed my year columns into your rows. 68 00:05:17,850 --> 00:05:19,650 It's labeled that column attribute. 69 00:05:19,770 --> 00:05:21,390 OK we'll fix that later. 70 00:05:21,480 --> 00:05:23,580 And that hasn't totally solved my problem. 71 00:05:23,580 --> 00:05:30,480 I still have unit sales and total revenue as my rows instead of columns but it's gotten me one step 72 00:05:30,480 --> 00:05:31,170 closer. 73 00:05:31,470 --> 00:05:36,300 And one thing to note before I move to the next step is that there's another way I could have done that. 74 00:05:36,300 --> 00:05:43,350 And let me just remove that step and instead of selecting all five of these year columns I could have 75 00:05:43,350 --> 00:05:48,930 selected this first column and chosen the pivot other columns option. 76 00:05:48,930 --> 00:05:52,870 So you arrive at the exact same place just another way to get there. 77 00:05:52,890 --> 00:05:57,170 So I've gotten a little bit closer got values here I've got years in a column. 78 00:05:57,270 --> 00:06:04,590 The only adjustment I need to make now is turn these unit sales and total revenue labels from rows into 79 00:06:04,590 --> 00:06:05,700 columns. 80 00:06:05,700 --> 00:06:12,330 So I need to do the reverse of what I just did and take this vertical orientation and pivot it up into 81 00:06:12,330 --> 00:06:13,590 a horizontal. 82 00:06:13,590 --> 00:06:20,470 So you guessed it I'm going to select that first column pivot the column and this says OK where do your 83 00:06:20,470 --> 00:06:21,660 values live. 84 00:06:21,730 --> 00:06:24,470 Do they live in the attribute column or the value column. 85 00:06:24,580 --> 00:06:27,670 In this case the value call in press OK. 86 00:06:28,120 --> 00:06:29,500 And there you have it. 87 00:06:29,500 --> 00:06:36,030 So now we've got first column which is attribute for a year and go ahead and name that call column year. 88 00:06:36,100 --> 00:06:39,270 We've got a unit sales column and a total revenue column. 89 00:06:39,280 --> 00:06:44,270 And this is a table format that I can work with as an analyst. 90 00:06:44,350 --> 00:06:51,100 So that was a great demo of how both pivot and unpinned it can be used to kind of wrestle a messy table 91 00:06:51,100 --> 00:06:53,860 format into something more workable. 92 00:06:53,890 --> 00:07:01,120 Now last quick demo here if I take this all the way back to the start just delete each of these steps 93 00:07:01,960 --> 00:07:06,630 back to square one because I'm not dealing with any duplicate values here. 94 00:07:06,820 --> 00:07:08,860 I could use transpose. 95 00:07:08,860 --> 00:07:13,690 In this case as well and in fact that's actually a more efficient way to do this. 96 00:07:13,720 --> 00:07:20,950 I could select this entire table as is and essentially flip it or rotate it onto its side using that 97 00:07:20,950 --> 00:07:22,660 transpose option. 98 00:07:22,660 --> 00:07:29,110 So in the transform menu I can just press transpose here and that pretty much did the trick it put years 99 00:07:29,110 --> 00:07:33,470 on a column put unit sales on a column and put revenue on the third column. 100 00:07:33,670 --> 00:07:39,190 The only thing we have to do now is use those first rows and promote Henares. 101 00:07:39,380 --> 00:07:40,100 And there you go. 102 00:07:40,100 --> 00:07:46,580 We've gotten to our same ending point using both combination of pivot pivot and transpose. 103 00:07:46,580 --> 00:07:51,560 So again kind of tricky to work with at first but these tools can be really really helpful when you 104 00:07:51,560 --> 00:07:52,850 need them. 105 00:07:52,850 --> 00:07:56,890 So with that we're going to go ahead and delete that query that I just created. 106 00:07:58,790 --> 00:07:59,650 There you go. 107 00:07:59,810 --> 00:08:03,360 Close out of the editor and there you have it pivoting and I'm pivoting. 11427

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