Easily Compare Multiple Tables in Power Query

Sdílet
Vložit
  • čas přidán 4. 08. 2021
  • Learn how to easily compare 3 or more tables in Power Query and avoid having to do lots of complicated query merges.
    0:33 Power Query Lists (Table Columns)
    1:02 Checking Source Data
    1:30 Load Table Into Power Query (Connection Only)
    2:30 Using #shared to Create Function Reference Table
    3:20 List.Intersect
    4:28 Filtering Table Using Table.SelectRows and List.ContainsAny
    6:33 List.Union
    8:13 List.Difference
    Download the Excel file that includes the data and queries in this video: www.myonlinetr...
    View my comprehensive courses: www.myonlinetr...
    Connect with me on LinkedIn: / myndatreacy
  • Věda a technologie

Komentáře • 153

  • @SusithJayamanne
    @SusithJayamanne Před 3 lety +3

    Amazing! Super efficient way of saving minutes, hours and quite possibly days of manual and boring work. Thanks again Mynda and Phil!

  • @GrainneDuggan_Excel
    @GrainneDuggan_Excel Před 3 lety +8

    Thanks Phil for such a clear demonstration of these LIST functions. I hope you do loads more MCode videos!

  • @shoaibrehman9988
    @shoaibrehman9988 Před 3 lety +1

    What a level of expertise, this is a way of professional power query gr8 video.
    I will learn and practice to implement in my daily work efficiently.
    Please continue power query videos.
    Thanks a lot

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Thank you Shoaib. I certainly intend to keep doing PQ videos like this. Regards, Phil

  • @naveen200848
    @naveen200848 Před 3 lety +1

    Explaining with real time use cases and hidden gem functions is awesome.

  • @mattschoular8844
    @mattschoular8844 Před 3 lety +1

    Thanks Mynda and Phil. I will be watching this one again when I'm at my desk...

  • @dcpowered
    @dcpowered Před 2 lety +3

    That was simply glorious!! I really enjoyed the explanation. Very calm and well spoken, both of you!! Please make more videos about tables in power query. Thank you!!

  • @trentonjjrr
    @trentonjjrr Před 3 měsíci +1

    It was very nice learning something new. I would have appended all three trainings. Transformed text to Proper. Grouped by Name for a count rows. Then add a merge query step to the Staff query to pull in the count. Add Conditional column that says if the [expanded column] equals null then 0 if not then [expanded column]. I think it’s a rather simple way to do it but just depends how you want your data presented.

  • @IvanCortinas_ES
    @IvanCortinas_ES Před 3 lety +2

    Excellent tutorial Mynda. I love your dedication and how well you explain it. Thank you for telling us these List functions of M language.

  • @excelemployeeleavetracker1274

    Saving Time and Saving Minds.....KEEP THEM COMING PLEASE!

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety +1

      Will do.

    • @sabarashid1513
      @sabarashid1513 Před 2 lety

      Hey Mynda truly appreciate for all the videos you create & share - be it excel or power query...they are full of information, knowledge and are of great help, as always.
      List.Intersect and union is great way to do away with merge - which takes time when you have large dataset...was looking for this so long...thanks

  • @malikastar9265
    @malikastar9265 Před 2 lety

    Thank you for this helpful tutorial, knowing the functions and how to use them make us understand the essence of PowerQuerry and be more confortable using them

  • @drewbbc7074
    @drewbbc7074 Před 2 lety +4

    Another approach - i) simply append all four tables - ii) do groupby & iii) subtract 1 & sort. Four lines of code gets you a nicely sorted table:
    Source = Table.Combine({Staff, Training_1, Training_2, Training_3}),
    GroupRows = Table.Group(Source, {"Name", "ID"}, {{"Count", each Table.RowCount(_), Int64.Type}}),
    Subtract = Table.TransformColumns(GroupRows, {{"Count", each _ - 1, type number}}),
    SortRows = Table.Sort(Subtract,{{"Count", Order.Descending}})

  • @alpeshshah891
    @alpeshshah891 Před 7 měsíci

    FANTASTIC INFORMATION, thank you for sharing this, I have so many uses for the list function now that I have seen the examples you have shown.

  • @zahoorsarbandi2982
    @zahoorsarbandi2982 Před rokem

    Very informative and useful.. Specially the speaking style of the lecturer is simply wonderful.

  • @vijayarjunwadkar
    @vijayarjunwadkar Před 3 lety +1

    Thank you Mynda & Phil for this super useful video! I just have a need for a similar data problem I am handling and this video is just in time to help me! Really appreciate! 😊👍

  • @bli240
    @bli240 Před 3 lety

    This is fabulous! Set theory in action!
    I’ve always dreaded merges given how slow they can get. Going to have to dig more into list functions. Thx so much for sharing!

  • @rsn29sep
    @rsn29sep Před 3 lety

    Big Thx to Mynda and team, yet another informative video.

  • @wayneedmondson1065
    @wayneedmondson1065 Před 3 lety

    Thanks Mynda and Phil. List functions are so powerful. Love to learn more ways to use them. Thanks for sharing :)) Thumbs up!!

  • @davidlinton4127
    @davidlinton4127 Před 3 lety +1

    Another great video! Thanks Mynda & Phil.

  • @chrishartnell8936
    @chrishartnell8936 Před 3 lety +1

    Very Powerful and simple technique. I like it!

  • @ricos1497
    @ricos1497 Před 3 lety +5

    Very good video. I'd have appended the three tables, using the training day (1,2,3) as an ID column then used power pivot for the rest, however this is a nice alternative. I'm always wary of producing my final result in power query (preferring to use it solely for transformation), but I'm not sure if my instincts are correct in that regard.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety +5

      Thanks Rico. Yes there are certainly other ways to achieve a solution. As I said in an earlier comment, I just want people to realise that table columns are lists and as such you can use List Functions to manipulate the data.

    • @dennerjd
      @dennerjd Před 2 lety +1

      @@MyOnlineTrainingHub I didn't even catch that part in the video (adult ADHD has its pros and cons), but that helps demystify Lists for me. Glad I read this comment.

  • @Hamish_A
    @Hamish_A Před 6 měsíci

    Love it! ❤ Really useful technique.

  • @conradblume4274
    @conradblume4274 Před 3 lety

    EXCELLENT!!! Thank you for taking the time to create this video

  • @the_slidemaster
    @the_slidemaster Před 3 lety

    It's really that much easy.. Thanks for the tutorial..! Great work..! 👍👏

  • @darrylmorgan
    @darrylmorgan Před 3 lety +1

    Hi Mynda! Some Really Helpful Tips And Techniques From Phil...Thank You Both :)

  • @albertogp84
    @albertogp84 Před 2 lety

    Another brilliant example on combining things in PQ. Amazing the way you think and approach PQ.
    Thanks a lot!
    I tried to use this approach with a table having 160.000 rows to select only ones matching my intersect list of 786 items, in place of my old method merge query and then removing the blanks, but it is super slow. Maybe in my case the old method remains faster for computation.

  • @EmronWalker
    @EmronWalker Před 2 měsíci

    Wow, opens my mind.

  • @yemiakinwande7039
    @yemiakinwande7039 Před rokem

    Excellent! Very useful

  • @jeremylau93
    @jeremylau93 Před 3 lety +1

    Mind blowing! Thanks for sharing.

  • @syedaneesdurez7197
    @syedaneesdurez7197 Před 2 lety +1

    Request to share more videos on such list examples and M Codes . Advise how can we learn M Code fast

  • @davidferrick
    @davidferrick Před 2 lety

    When I was young my dad gifted me an axe. I was super stoked about using it but there was no wood. I had to wait until we got some wood months later for winter to use that axe. I often feel like that boy with the axe when I see these cool tricks yet have no application needs. :)

  • @pavol.cernak
    @pavol.cernak Před 3 lety +1

    No words. Just thumbs up!

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Thanks Pavol

    • @pavol.cernak
      @pavol.cernak Před 3 lety

      Just tried it on my tables. Very nice. I typically merge tables according to a unique combination of 2+ columns (ex. "Location", "Account", same accounts in various locations). Is it possible tu use this method somehow?

  • @gbemisolaadewuya2755
    @gbemisolaadewuya2755 Před 2 lety

    Amazing !! useful in power BI, multiple columns and multiple tables

  • @pradyumnmishra9984
    @pradyumnmishra9984 Před 2 lety

    Thank you so much for such a knowledgeable video, its just awesome

  • @BrianStettenbenz
    @BrianStettenbenz Před 3 lety

    Thank you for the helpful tips.

  • @Sri-Nivas
    @Sri-Nivas Před 3 lety

    Great Tutorial Linda & Phil..!! Keep up the good work..!!

  • @NihonDream
    @NihonDream Před rokem

    I am speechless. So simple and so powerful. How to learn how to understand the way those functions work to be able to use similar techniques on my own? CZcams, training, literature?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před rokem +1

      Glad it was helpful!

    • @NihonDream
      @NihonDream Před rokem

      @@MyOnlineTrainingHub How to develop the skills to the level you have showed in the clip? I mean operating M language in that way? I am fascinated, obsessed, filled with desire to be able to get closer to that level in a more organised way. This is why I have asked the question about how to make it happen? Do you have M language focused training?

  • @FredericLEGUEN-Excel
    @FredericLEGUEN-Excel Před 3 lety

    The trick at 05:55 is amazing 👍

  • @jozefl204
    @jozefl204 Před 9 měsíci +1

    Super. What is faster, List or Merge ? I have thousands of rows and 20 columns.

  • @clivepetty2338
    @clivepetty2338 Před 3 lety

    Thanks for this, looks very powerful -

  • @martinpaulbannister1745

    Thank you. Good demonstration

  • @emirhantekin1800
    @emirhantekin1800 Před 2 lety

    Top notch.

  • @djerikgerst12
    @djerikgerst12 Před rokem

    thanks. perfect

  • @eduedu726
    @eduedu726 Před 3 lety +1

    thanks a lot.

  • @Adam_K_W
    @Adam_K_W Před 3 lety

    Very well done!

  • @donmcgimpsey1706
    @donmcgimpsey1706 Před 10 měsíci

    I just spend 2 hours with join steps. For some reason the "ANTI" joins are backwards to me.. but still work. This list technique will replace all the merges for me
    Thanks!

  • @guadalupeaguilera7818
    @guadalupeaguilera7818 Před 3 lety

    A GREAT TOOL, THANKS LOT

  • @mirrrvelll5164
    @mirrrvelll5164 Před 3 lety

    Informative video. Saved video in a list of favorites =)

  • @summerbreeze7885
    @summerbreeze7885 Před 3 lety

    Thank you Mynda, thank you Phil. Always thankful for your tutorial.
    Quick question, on the Function reference query, as we click on the value column (contains function), how do we switch between showing function description in the window below versus adding a step in creating value in the query?
    Thank you and if you might taught us already that I've overlooked, my apology.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Thanks Summer.
      You mean after I show how to use #shared? That's a query just for looking at the functions so to add a step to the main queries, click back on one of the main query names then add a step as you would normally, either via menus or right clicking beneath the Applied Steps and adding one.
      Phil

  • @pierreruwet8479
    @pierreruwet8479 Před 2 lety

    Hello, nice function demonstration, but the most impressive for me is the helper assistant that shows automatically the syntax of the function below the formula bar of PQ during the encoding of the function and parameters . How do I activate this on my Excel? Is it an add-on? It it working also when using function in the add custom column interface? Thanks for any feedback

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 2 lety

      Thanks, Pierre. The intellisense tool in Power Query is available to those with a Microsoft 365 license.

  • @skimpylemon8034
    @skimpylemon8034 Před 2 lety

    Excellent video! This is what I was after. Does anyone know how to do a True/false test on the List.Intersect function?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 2 lety

      Glad it was helpful. Please post your question and sample Excel file on our forum where we can help you further: www.myonlinetraininghub.com/excel-forum

  • @sadinenim5360
    @sadinenim5360 Před 2 lety

    This is awesome Phil. what if after getting the list I need to get the data fields from multiple tables which we have used in the list.intersection function. can you please help me on this.

    • @philiptreacy714
      @philiptreacy714 Před 2 lety

      Thanks Sadineni. I can think of a few ways to do this but it could be tricky depending on what you data looks like. Can you please start a topic on our forum and supply some sample files so I can have a look.

    • @sadinenim5360
      @sadinenim5360 Před 2 lety

      @@philiptreacy714 Sure Philip I can do that

  • @leebecker8255
    @leebecker8255 Před 2 lety

    Thanks for this! Is this method a much more efficient way to do a Vlookup type thing compared to Merging tables? Are there any times when it would be better to use Merging? I'm thinking maybe if I need to pull in all the columns from both tables? Would it be better to use Merge then instead of adding lots of columns individually using list functions? I have a query that I run every month that works well, but it is SO slow (as in it can sometimes take over an hour to run). My query uses quite a lot of merges, so I'm really looking forward to trying this method. Thanks!!! :D

  • @vacilando86
    @vacilando86 Před 3 lety +1

    On the "Attended No Days", can we use just the name of "Attended At least one day" to exclude, insteadt of putting formula?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety +1

      Hi Alpay,
      Almost! You'd also need to reference the Name column too, just using #"Attended At Least 1 Day" would return the whole table from that query.
      So this would work:
      = List.Difference( Staff[Name], #"Attended At Least 1 Day"[Name] )
      Cheers
      Phil

  • @michaelmartinez8427
    @michaelmartinez8427 Před 3 lety

    I love this method and want to be able to use it across all of the different reports I have to create and/or maintain. For some reason tho, when I take this approach and follow the exact steps in the video, my excel file jumps in size and and take upwards of 10 minutes just to load the data. If i remove these steps within my power query, my excel file goes back to a much faster loading state.
    A couple things to note - I am working with data that I am loading externally from a OneDrive Business account. The data lives in this external data source on 4 separate tabs each formatted as an excel table. I copy and paste data from an ERP so that it can be viewed and formatted for the purposes of reporting.
    My questions/need for some guidance: Would having a power query, based on external data, limit the usability of some basic query functions (like List.Sum or List.PositionOf)? if not, what are some things I should consider that could be bogging down the speed at which my data can be loaded within PQ and ultimately back into Excel for Pivot Tables and such?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Hi Michael,
      Hard to say exactly without seeing your code. You say you are doing exactly as shown in the video - from what point? Just calling the List functions? Perhaps you need to use the List.Buffer function, really not sure what you are doing without seeing your code. Can you post it on our forum for me to have a look at www.myonlinetraininghub.com/excel-forum
      Phil

  • @Fatababei
    @Fatababei Před 2 lety

    I have 2 tables and one column have the same values in both tables but i need to check them if true or false and return only the false one. is this explained in the video ?

  • @sarajvo2010
    @sarajvo2010 Před 3 lety

    Great!

  • @leebecker8255
    @leebecker8255 Před 2 lety

    Also, can you compare tables based on multiple columns? Like when you merge tables based on exact match of First name and Surname?

  • @JoseAntonioMorato
    @JoseAntonioMorato Před 3 lety

    When will your videos come out about the new matrix functions BYCOL, BYROW, ISOMITTED, MAKEARRAY, MAP, REDUCE and SCAN? 😀🤗

  • @LukitoPerkasa
    @LukitoPerkasa Před 3 lety

    Thanks Phil and Mynda!
    But if I just need to make the intersection list and then do a filter based on the intersection list, is it more efficient doing it this way or just using the traditional way of merging and give tag "exist in another list" sort of way? I have 200k rows of data to be checked to 50k data btw. I'm also going to check the duration of both methods actually.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety

      Hi Lukito,
      Not sure what you mean by 'do a filter based on the intersection list'. Are you filtering the list created by the intersection? Not sure how the filtering is related to using List.Intersection vs merging tables.
      You may find that using List.Buffer on your lists gives improved performance.
      Regards
      Phil

  • @mshi5826
    @mshi5826 Před 2 lety

    Thanks and But if I want to get at least 2 days or n days trainings, how to get it.

  • @flaviobertasi2728
    @flaviobertasi2728 Před 2 lety

    Thanks for this very helpful vid. One problem though: I tried to download the example file, but the link didn't work.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 2 lety

      I tested the link. It works for me. Be sure to read the instructions on the page. If you still have problems, try a different browser. Hope that helps.

    • @flaviobertasi2728
      @flaviobertasi2728 Před 2 lety +1

      @@MyOnlineTrainingHub Thank you for your quick reply. Now it works. I don't know where the problem was. Anyway, thanks again.👍

  • @ericlei2207
    @ericlei2207 Před 2 lety +1

    This is more concise but seems slower in terms of performance. Maybe you can compare the pros and cons of each method next time?

  • @user-uj6vj8nn8w
    @user-uj6vj8nn8w Před rokem

    I tried to use this method, but the data takes a long time. I'm pulling it in from sharepoint.

  • @davidmwape8143
    @davidmwape8143 Před 2 lety

    Sorry, where can I find this green excel shirt.

  • @aymanraouf1820
    @aymanraouf1820 Před rokem

    So does "Union" mean at least one of them?

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před rokem

      A union requires you to specify at least one column to match in each table.

  • @gchehabayesa1006
    @gchehabayesa1006 Před 2 lety

    I'm a total noob and I got lost at 1:30
    I mean, if the table is already loaded (because we see it there), I don't get the point of creating the connection. Doesn't the connection already exist, since the table Training 3 is on screen?

    • @philiptreacy714
      @philiptreacy714 Před 2 lety

      Hi, you see the tables on screen because they are in the Excel sheet. But that doesn't mean they are loaded into Power Query. You must load the data into PQ to do any PQ transformations on it. The transformed data can then be sent back out to the Excel sheet into a new table. Please check out our PQ course to learn more www.myonlinetraininghub.com/excel-power-query-course

  • @lcorcoran56
    @lcorcoran56 Před 3 lety

    I do this quite a lot, But the way I do it is I add a column to each table and fill in the Table name for each record, I them append all the tables to one master table and I then use a pivot table, I add the table name to the Columns & the Values fields. am I mad for doing it this way? It works good for me when I getting data form a number of files in a folder.

    • @ricos1497
      @ricos1497 Před 3 lety +1

      I'd do it that way too, but it depends on use case. Obviously the video contained just an illustration rather than a working example. I can't imagine any real world requirement for creating three lists. Rather you would have a dimension table of names (and maybe one of training session details) and a fact table containing the three training session attendances as you suggest. You'd then perhaps calculate the number of training sessions attended in Dax, or a percentage of sessions attended or whatever. The problem with creating lists is that the very next request from management will be another item of data that you'll need another list for! That would soon add up and become inefficient, having the data in a single fact table would require just a new measure for each request.
      Again, the purpose of the video was to show the list functions, which it does very well.

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 3 lety +2

      Hi Liam,
      As Rico said, it depends on your own case and what you want as a result. If you've got a way that works then great. I'm trying to present an alternative that people may not have realised is possible.
      The key point that I'm trying to get across is that table columns are Lists and as such you should be thinking, can I use a List function to do what I need?
      You won't always need or want to use List functions, but people should be aware that they can.
      Regards
      Phil

    • @lcorcoran56
      @lcorcoran56 Před 3 lety

      @@MyOnlineTrainingHub Yes, It's good to learn new ways of doing things. I never know when I come across something new and I need a different way of doing something, that's why I love watching your channel. Keep up the good work. It's much appreciated 🙂

  • @101010Meaning
    @101010Meaning Před 3 lety

    Great video - BUT the music was both annoying and distracting

  • @polimetre
    @polimetre Před 10 měsíci

    This guy made me sleeping.

  • @pascaljoly5752
    @pascaljoly5752 Před 9 měsíci +1

    Too complicated for me

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 9 měsíci

      If you need a hand, please post your question and sample Excel file on our forum where someone can help you further: www.myonlinetraininghub.com/excel-forum

  • @rokutime2627
    @rokutime2627 Před 2 lety

    1.2k likes, 18 dislikes. Fire the CZcams CEO for protecting sponsors and removing control from users.

  • @ottomulder7279
    @ottomulder7279 Před 2 lety

    For me: Power Query is too difficult

    • @MyOnlineTrainingHub
      @MyOnlineTrainingHub  Před 2 lety +1

      Sorry to hear that, Otto. This is an advanced tutorial. Have you seen my introduction to Power Query which doesn't use any coding: czcams.com/video/L4BuUzccLpo/video.html

    • @emirhantekin1800
      @emirhantekin1800 Před 2 lety

      At first you may struggle but if you can keep trying for a while you"ll get the hang of it.