All language subtitles for 12. Merging Queries in Power BI Desktop

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,750 --> 00:00:03,960 All right next on the agenda we have merging queries. 2 00:00:03,960 --> 00:00:10,080 So you see the merge queries option in the Home tab of the query editor and when you click that button 3 00:00:10,320 --> 00:00:17,070 it'll open up a dialog box like this where you can select two tables and matching columns in order to 4 00:00:17,070 --> 00:00:18,880 create a merged table. 5 00:00:19,080 --> 00:00:23,200 And basically this works just like a V look up works in Excel. 6 00:00:23,370 --> 00:00:29,700 You're joining information from two different tables based on some common column or key. 7 00:00:29,700 --> 00:00:36,000 So in this example that we're looking at here we're merging a table called A.W. sales data with another 8 00:00:36,000 --> 00:00:38,070 table called A.W. product look up. 9 00:00:38,070 --> 00:00:41,730 Both of which contain a matching product key column. 10 00:00:41,730 --> 00:00:48,720 So essentially what we'll be doing here is grabbing information or attributes about those product keys 11 00:00:48,990 --> 00:00:55,560 from the product lookup table and pulling the men or betting them into our sales table by matching them 12 00:00:55,620 --> 00:00:57,630 to the associated product keys. 13 00:00:57,630 --> 00:01:04,710 So my trick for remembering this is that merging adds columns to an existing table you're not adding 14 00:01:04,710 --> 00:01:11,080 any rows you're pulling in more information and making your table wider by adding columns. 15 00:01:11,310 --> 00:01:17,820 So very important point here just because you can merge tables and because it's an interesting tool 16 00:01:17,820 --> 00:01:21,260 to use doesn't mean that you should in fact. 17 00:01:21,300 --> 00:01:28,340 Generally speaking it's better to keep tables separate and define relationships between them within 18 00:01:28,340 --> 00:01:29,340 a data model. 19 00:01:29,370 --> 00:01:30,930 So more on that later. 20 00:01:31,020 --> 00:01:35,720 But keep that idea in the back of your head that you can merge queries like this. 21 00:01:35,820 --> 00:01:38,530 But it's not always the most efficient solution. 22 00:01:38,640 --> 00:01:43,740 So why don't we go ahead and jump into our query editor and I'll show you what one of these merges actually 23 00:01:43,740 --> 00:01:44,870 looks like. 24 00:01:45,240 --> 00:01:45,590 OK. 25 00:01:45,600 --> 00:01:50,710 So I'm in the query editor of my Adventure Works report right where we left off. 26 00:01:50,720 --> 00:01:58,650 I've got my product table customers calendar and my sales 20:17 data now to demo the idea of merging. 27 00:01:58,680 --> 00:02:05,460 Let's say that we want to look at our sales data you know which has our quantities and our keys for 28 00:02:05,460 --> 00:02:11,130 territory customer and product and let's say I want to pull a little bit of information about these 29 00:02:11,130 --> 00:02:18,330 products right here and to my sales table without having to look at a product key and find that associated 30 00:02:18,330 --> 00:02:23,150 product key here in the product lookup table and get my information that way. 31 00:02:23,160 --> 00:02:26,790 Let's say I just want that information accessible in one place. 32 00:02:26,790 --> 00:02:30,730 I want to pull those columns right in there to the sales 20:17 table. 33 00:02:30,930 --> 00:02:34,150 That's a case where you could use a tool like merge. 34 00:02:34,260 --> 00:02:37,140 So I'm going to start by selecting the sales table. 35 00:02:37,320 --> 00:02:42,840 I'm in my Home tab all the way on the right you'll see the merge and append options we're in it talk 36 00:02:42,840 --> 00:02:44,440 about append next. 37 00:02:44,580 --> 00:02:47,100 But within merge I can do it two different ways. 38 00:02:47,100 --> 00:02:49,210 It can merge or merge as new. 39 00:02:49,260 --> 00:02:54,730 And if I just simply merge queries it will preserve the exact tables that I have in place now. 40 00:02:54,870 --> 00:03:02,800 It will just add the merged columns into my existing A.W. sales 20:17 table if I choose the second option. 41 00:03:02,820 --> 00:03:09,840 It's going to create a brand new merged table that contains the merged result while maintaining my original 42 00:03:09,900 --> 00:03:11,760 component tables as well. 43 00:03:11,760 --> 00:03:16,830 So I don't really need or want that option at this point so I'm going to go with the first option just 44 00:03:16,830 --> 00:03:22,850 merge queries and what I see here is all right I've got my first table the one I've selected already 45 00:03:22,860 --> 00:03:29,760 populated here on the top half of the screen and now it just says select a table and the matching columns 46 00:03:30,120 --> 00:03:35,980 to create this merge so I can choose from one of my other queries or tables here. 47 00:03:36,210 --> 00:03:41,760 In this case let's go with A.W. product Look-Up gives me a little preview here as well. 48 00:03:41,850 --> 00:03:50,500 And now the only column that actually matches here if I look through these is that product key column. 49 00:03:50,540 --> 00:03:56,400 So I'm going to go ahead and select product key in the product table selected in the sales data and 50 00:03:56,400 --> 00:04:03,460 I get this nice green check mark that says it's matched twenty nine thousand 481 out of the first twenty 51 00:04:03,460 --> 00:04:05,680 nine thousand four hundred eighty one rows. 52 00:04:05,700 --> 00:04:09,060 So you've got a perfect match here which is always good to see. 53 00:04:09,300 --> 00:04:11,560 So don't worry about the join kinds here. 54 00:04:11,580 --> 00:04:17,210 There are a few different options different types that you can choose from the default left outer is 55 00:04:17,220 --> 00:04:18,630 typically the one you want. 56 00:04:18,630 --> 00:04:25,470 It's basically saying take all the product keys that exist in my first table and grab any rows that 57 00:04:25,470 --> 00:04:26,340 find a match. 58 00:04:26,400 --> 00:04:30,560 From my second table and for our purposes that will do the trick. 59 00:04:30,660 --> 00:04:31,880 So it's OK. 60 00:04:32,770 --> 00:04:38,560 And you see what happens here it added a column but the column looks kind of funny it says table and 61 00:04:38,560 --> 00:04:40,220 it's formatted with these links. 62 00:04:40,360 --> 00:04:45,090 So there's one extra step we have to take here which is to click this button here. 63 00:04:45,250 --> 00:04:51,100 That actually expands the table out and converts it into the actual columns that I want. 64 00:04:51,100 --> 00:04:55,630 So by default it selects all of the columns from the product table. 65 00:04:55,630 --> 00:05:02,140 If I press OK it would pull in all 10 or 12 of these columns into my sales table. 66 00:05:02,140 --> 00:05:07,630 In this case I don't want all of them let's just pull in the product key so that we can make sure we 67 00:05:07,630 --> 00:05:12,850 have a match and maybe the product name and the color. 68 00:05:12,850 --> 00:05:17,280 And this last check box here just determines what the name of the column is going to look like. 69 00:05:17,330 --> 00:05:22,390 And if I leave this selected it's going to create a prefix for every column with the name of the product 70 00:05:22,390 --> 00:05:26,620 table which for the sake of this example that's fine. 71 00:05:26,620 --> 00:05:34,150 So when you press OK it basically expands that temporary table column into the three columns that I 72 00:05:34,150 --> 00:05:37,540 had selected from the list the product key. 73 00:05:37,630 --> 00:05:43,920 And again it's got that prefix of the table name the product name and the product color. 74 00:05:43,930 --> 00:05:54,290 So if we scroll to our original product key is got product 5:29 2:14 scrolling to the right 5:29 2:14 75 00:05:54,340 --> 00:05:56,200 you can see that it matched. 76 00:05:56,200 --> 00:06:01,600 And now we have this new information that hadn't existed in the sales table up to this point about the 77 00:06:01,600 --> 00:06:07,810 product name and about the product color and it's populated for every single row in our table just like 78 00:06:07,810 --> 00:06:09,830 a V Look-Up would have in Excel. 79 00:06:10,120 --> 00:06:16,510 So like I hinted at earlier just because we can do things like this and merge or tables together doesn't 80 00:06:16,510 --> 00:06:22,240 mean we always should in fact merging information in the way that we just did actually creates a lot 81 00:06:22,240 --> 00:06:28,810 of duplicative and redundant data which can be avoided entirely using table relationships instead. 82 00:06:28,810 --> 00:06:30,620 So again we're getting there soon. 83 00:06:30,790 --> 00:06:35,810 But for now let's go ahead and delete that merge that we just did. 84 00:06:36,040 --> 00:06:37,680 And we're back to where we started. 85 00:06:37,930 --> 00:06:40,530 So there's a quick demo for how to merge queries. 9378

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