each & underscore_ in Power Query Explained

Sdílet
Vložit
  • čas přidán 30. 07. 2024
  • Check out our newly launched M Language course ↗️ - goodly.co.in/learn-m-powerquery/
    Finally, the most requested video is here. I'll discuss the nuances of 'each' & '_' keywords in Power Query.
    ===== ONLINE COURSES =====
    ✔️ Mastering DAX in Power BI -
    goodly.co.in/learn-dax-powerbi/
    ✔️ Power Query Course-
    goodly.co.in/learn-power-query/
    ✔️ Master Excel Step by Step-
    goodly.co.in/learn-excel/
    ✔️ Business Intelligence Dashboards-
    goodly.co.in/learn-excel-dash...
    ===== LINKS 🔗 =====
    Blog 📰 - www.goodly.co.in/blog/
    Corporate Training 👨‍🏫 - www.goodly.co.in/training/
    Need my help on a Project 💻- www.goodly.co.in/consulting/
    Download File - goodly.co.in/each-underscore_...
    ===== CONTACT 🌐 =====
    Twitter - / chandeep2786
    LinkedIn - / chandeepchhabra
    Email - goodly.wordpress@gmail.com
    ===== CHAPTERS =====
    0:00 Intro
    0:16 Understanding 'each' & Underscore_ in a Context of a Table
    2:45 Understanding 'each' & Underscore_ in a Context of a List
    4:27 Alternate to 'each' & Underscore_ in a Table
    7:05 Alternate to 'each' & Underscore_ in a List
    8:48 My Courses
    ===== WHO AM I? =====
    A lot of people think that my name is Goodly, it's NOT ;)
    My name is Chandeep. Goodly is my full-time venture where I share what I learn about Excel and Power BI.
    Please browse around, you'd find a ton of interesting videos that I have created :) Cheers!
    - - - - -
    Music By: "After The Fall"
    Track Name: "Tears Of Gaia"
    Published by: Chill Out Records
    - Source: goo.gl/fh3rEJ​
    Official After The Fall CZcams Channel Below
    czcams.com/channels/GQE.html...
    License: Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
    Full license here: creativecommons.org/licenses
  • Věda a technologie

Komentáře • 171

  • @amitk1208
    @amitk1208 Před rokem +20

    The best part of your teaching is you deep dive and great explanation and make the things easier to understand

  • @konigkakfas3392
    @konigkakfas3392 Před měsícem +2

    Short into the point - cool, thx!

  • @navisalomi
    @navisalomi Před rokem +5

    Thanks so much. It's good to know both the each syntax sugar and the declaring a variable like (r)=>. There are cases where you're nesting functions. Once you use each _ once, if you use it again , it overwrites the first one. So, be careful. If you must use each again, declare the variable.
    Example, Table.AddColumn(Source, "NewCol", each {_[Amount]} & List.Transform({2,3,4}, (x)=> x * _)).
    You can't use the each _ in the List.Transform function. You will overwrite the first _ and cause the functions to crash.

  • @EmpyrialArchangel
    @EmpyrialArchangel Před 3 měsíci

    THANK YOU! I spent HOURS reading documentation, but all I needed was 10 minutes on CZcams. You're my hero!

  • @MichaelBrown-lw9kz
    @MichaelBrown-lw9kz Před rokem +4

    This is by far the best explanation I have seen regarding "each" and "_". I finally understand this. Thank you so much

  • @mohitoshbiswas4797
    @mohitoshbiswas4797 Před rokem

    Great explanation of each and _ keywords and their applications. Thanks Chandeep 👍

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

    You are really good at explaining things… 👍

  • @rpopecpa
    @rpopecpa Před 4 měsíci

    Thank you for this video!! A simple bit of valuable information to add to my knowledge base.

  • @Hello-bn2yc
    @Hello-bn2yc Před 7 měsíci

    Finally I was able to get it... Thank you so much Chandeep.

  • @mohamedfouad7958
    @mohamedfouad7958 Před rokem +1

    Love you man, I learned a lot from you and still learning

  • @iantotheh
    @iantotheh Před rokem +2

    Such an eloquent explanation of something I've been wondering for a while!

  • @QuantumIdeas
    @QuantumIdeas Před 8 měsíci

    Fantastic video, Chandeep! Each, _, () and => have been so mysterious to me before viewing this video. This is a huge for me.

  • @williamarthur4801
    @williamarthur4801 Před rokem

    Thank you, its' about time soneone tackled this topic, I rememeber when I first started looking at M being very cofused by the Fuction (_, , that I would see. I still find there use confusing / interesting in that sometimes using a named function eg (A)=> A[whatever], will work whereas each [whatever] , might not.
    Thank you for all your work in putting these videos together.

  • @rohanbhattacharyya6600
    @rohanbhattacharyya6600 Před 11 měsíci

    Very informative. Thanks!

  • @arunkumarkesavan6077
    @arunkumarkesavan6077 Před rokem

    Now I cant say to anyone that I am good in Power BI after watching your vidoes!!! you're the person to say it...

  • @kamleshmistry2728
    @kamleshmistry2728 Před rokem

    hats off. thanks for great content.

  • @ajieapen
    @ajieapen Před rokem

    ah... I've been waiting for this since ages... No words to thank you, Chandeep... :)

  • @roywilson9580
    @roywilson9580 Před rokem +1

    Thanks for the interesting video. I wish someone had explained this so clearly when I first tried to work out what the each and _ were doing and how to use them.

  • @isidreb
    @isidreb Před rokem

    A great explanation, using examples that are easy to understand. Thanks for sharing!!

  • @komanguy
    @komanguy Před rokem

    Great! Very well explained, the meaning of the underscore and how to define a function. Thank you very much.

  • @ajayv304
    @ajayv304 Před rokem

    I watched this video a few months back and I listened to it now. Understood clearly.
    Thanks a lot.

  • @wayneedmondson1065
    @wayneedmondson1065 Před rokem +6

    Awesome explanation Chandeep! I think of each as shorthand for the function (myVar)=> and underscore as the variable myVar, as in (using your example): (myVar)=> myVar[Amount] to extract the amount from the record. I believe it is confusing to people because they experience each and _ before learning to formally declare functions. If they learned the formal way first and then learned the shorthand of each and _ it might be easier. Thanks for a great explanation.. alway good learning at Goodly! Thumbs up!!

    • @GoodlyChandeep
      @GoodlyChandeep  Před rokem +4

      I am with you a 💯 percent. That is also because the UI generates the shorthand code and that is what people see and try to understand.😁
      Personally I feel the each _ is more humanly to read.

  • @EricHartwigConsulting

    Great video and really detailed explanation in the use of the "each" and "_".
    Thank you for making this video!

  • @dilip1able
    @dilip1able Před rokem

    Awesome Chandeep

  • @90hsilva
    @90hsilva Před 8 měsíci

    very clear as usual mate, thanks :)

  • @jaymehta3320
    @jaymehta3320 Před rokem

    Thanks for sharing this. Haven't used each and _ that much but this helps to encourage and see where I can use it to make the queries more efficient/effective.

  • @seanys
    @seanys Před 15 dny

    I wish I had seen this video when I first started trying to use Power Query.

  • @larmondoflairallen4705

    My prayers have been answered. Thank you, Chandeep!!!!

  • @johnfunet
    @johnfunet Před rokem

    Very interesting video, thanks for the excellent way you explain step by step. Very professional.

  • @ramkumarsai9846
    @ramkumarsai9846 Před rokem +1

    Hi. I loved your way of explaining and I have learned lot of stuff from your video’s.
    I have strucked some part of the work like dynamically comes column headers from the row data. In power BI. Could you please help me on the same.

  • @stephanedelaval6525
    @stephanedelaval6525 Před rokem

    Clear and neat. Thank you for the explanation

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

    Great!

  • @oscarmendez-roca9181
    @oscarmendez-roca9181 Před rokem +5

    Great video and explanation with simple examples. I suggest to continue with the use of double "each" in case of working with arrays (List of a List). Thanks Chandeep!!

    • @Vandalfoe
      @Vandalfoe Před rokem +1

      Yes, please. I'm struggling to know how to work with 'each' row of a table, say, if one is added from a merge, for example. How do I access the "outside" underscore?

    • @MrDonkey912
      @MrDonkey912 Před rokem +1

      @@Vandalfoe If you name your variables, you can access both, ex:
      = Table.AddColumn(
      s, "n",
      (row) => List.Select(
      l, each _ = row[Name]
      ), type any )

  • @skimpylemon8034
    @skimpylemon8034 Před rokem

    Fantastic video with a excellent explanation! Thank you Chandeep!

  • @karimallahwala7022
    @karimallahwala7022 Před rokem

    You teach great Knowledge. Very helpful thank so much.

  • @elikent78
    @elikent78 Před rokem

    spent an hour trying to understand this from someone else's lesson yesterday, and couldn't get it. but you, in ten minutes, done. fantastic, chandeep.

    • @GoodlyChandeep
      @GoodlyChandeep  Před rokem +2

      Hey Eli, I spent an hour in planning the video to explain in 10 mins 😁
      I am glad it helped.
      Cheers

  • @KuldeepSingh-nq1vi
    @KuldeepSingh-nq1vi Před rokem

    Most awaited Video, Thank you so much that you created video on this topic and very nicely explained each and "_" keyword. It will help us to understand complicated M code..I appreciate your dedication towards teaching us..we would expect other basic videos like this from you.. Please make video on how to create custom functions in power query from scratch..

  • @IvanCortinas_ES
    @IvanCortinas_ES Před rokem

    Superb explanation. It can't be explained better. Thank you Chandeep!!!

  • @justinwduff
    @justinwduff Před rokem

    I know very little about M, but how you explained this made a lot of sense. Thank you.

    • @GoodlyChandeep
      @GoodlyChandeep  Před rokem

      Thanks Justin :)
      To learn more about M, You can refer to this video.
      czcams.com/video/5s8Ky5r43uI/video.html

  • @vacilando86
    @vacilando86 Před rokem

    Finally, It's understood 😄 , Thanks for your endless effort.

  • @pmsocho
    @pmsocho Před rokem

    Great explanateion! Thanks!

  • @OmisileKehindeOlugbenga

    Thank you Chandeep. Very simple to follow and remember.

  • @zahoorsarbandi2982
    @zahoorsarbandi2982 Před rokem

    The explanation of "each" and "_" has been been done in a very simple and effective way... zabar10

  • @briandelaney6354
    @briandelaney6354 Před rokem

    Thanks for this explanation - very clearly explained 👊

  • @seamushand8439
    @seamushand8439 Před rokem

    Thank you Chandeep, very well explained

  • @OdelLeal
    @OdelLeal Před rokem

    Great job and very helpful your information. Súper.

  • @matheusosa
    @matheusosa Před rokem

    Great explanation!

  • @matheussvs
    @matheussvs Před rokem

    Thanks man! Youre amazing

  • @brij26579
    @brij26579 Před rokem

    Awesome explanation & clarity 👌👍

  • @user-ji5uk8tq8u
    @user-ji5uk8tq8u Před 4 měsíci

    Hi, thanks for the great explanation. A little crazy question... Is there any way to turn PQ editor in black theme as you did?

  • @stefanoconti4472
    @stefanoconti4472 Před měsícem

    Thank you very much, excellent and very clear explanation. Your videos are very beautiful and really helpful for everyone.
    But please try to speak SLOWER, your spoken English is too fast, sometimes the words overlap and it is not clear what you mean. Thank you

  • @balakrishnaj1713
    @balakrishnaj1713 Před rokem

    This video is very helpful, thanks a ton 😀

  • @Faisal63045
    @Faisal63045 Před rokem

    Thank you for sharing this info if there's any example from the real world scenario it would be great

  • @kiran521
    @kiran521 Před rokem

    Thanks Chandeep, please make video on problems occur in bidirectional direction and why it is not feasible

  • @anilyadav-rt4sr
    @anilyadav-rt4sr Před rokem

    Thanks Your power query video is too good

  • @Bic2705
    @Bic2705 Před měsícem

    I have a lot of difficulty creating a conditional transformation that involves more than one column. I would really like a video about it.

  • @cooolbreeze
    @cooolbreeze Před rokem

    Really well explained.

  • @FRANKWHITE1996
    @FRANKWHITE1996 Před rokem

    Thanks for sharing ❤

  • @stefaanlouette
    @stefaanlouette Před rokem

    Awesome video

  • @kennethstephani692
    @kennethstephani692 Před rokem

    Great Video as usual, Chandeep!!

  • @thebhaskarjoshi
    @thebhaskarjoshi Před rokem

    amazing thanks!

  • @kerryhaxton1980
    @kerryhaxton1980 Před rokem

    Thanks for you time to help us along. I have an each and underscore that I'm trying to resolve. and maybe getting myself twisted up: I'm working on a sheet, and I want to change every occurrence of a character (% in my case) to a VALUE (Happens to be the Column header). I have the column names to which I'm applying the transformation in a list (Collist), and think I want to apply a process like
    List.Transform(Collist, each {_, each Text.Replace(_,"%", XXX)}))
    But I want the XXX to be represented by the same value from Collist.
    In my test sample Collist contains 3 values:
    When I change XXX to a literal, the process works, and all the "%" values are changed to "XXX".....but in real like I have a number of nested tables, with varying number/names of columns over which I need to perform the transformation:
    Sorry long winded question

  • @avecNava
    @avecNava Před rokem

    each seconds of this video is great :)

  • @bhaveshh5786
    @bhaveshh5786 Před rokem

    Hey Chandeep, i want to calculate turn around time if a transaction received after 3pm it should consider next day to calculate it with close date. Also it should only consider the business days excluding Saturday and Sunday. Thanks in advance.

  • @Albert-zf8ct
    @Albert-zf8ct Před rokem

    nice!

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

    Love your content and short explanations. Pls let me know if u have got discount for ur courses!!

  • @kebincui
    @kebincui Před rokem

    Well explained👍

  • @gennarocimmino
    @gennarocimmino Před rokem

    Thanks very much

  • @alexandresalome2684
    @alexandresalome2684 Před 5 měsíci

    Excellent explanation, thank you!
    I have a question: is it possible to change the value of a simple item in a column, based (table.transformRows, each , if, then, else) on another column, without adding a new column?
    example: [Name] = a,b,c and [Years] = 10,20,30
    if [Name ] = c then [Years] = 40 .
    (without using "table.addcollumns", that is, changing directly on column [Years]?)
    If yes, Is it possible create a video about it?

  • @kkhalidabed
    @kkhalidabed Před rokem

    Well Done

  • @alvarorodriguezlasso
    @alvarorodriguezlasso Před rokem

    You are a crack, regards from Cali Colombia

  • @muralidharannatarajan4251

    Super explanation

  • @santoshpv321
    @santoshpv321 Před rokem

    Supreme!!!

  • @mohitupadhayay1439
    @mohitupadhayay1439 Před rokem

    Chandeep praji
    Real time DAX scenario ki playlist bana dijye for interview.

  • @oliverscheurich9202
    @oliverscheurich9202 Před rokem +1

    Great. You should have 320.000 subscribers instead of 32.000.

  • @frachiar4444
    @frachiar4444 Před 5 měsíci

    Grazie.😀

  • @mmuthuvel6829
    @mmuthuvel6829 Před rokem

    Very clear explanation. Do you have any course in Udemy?

  • @Moellz
    @Moellz Před rokem

    Hello Chandeep,
    great video. I really like the short explanations about one topic that you're posting recently.
    One question: Why does "r" in the section about alternate to each_ hold every record of the table? Is it because of the name?

    • @GoodlyChandeep
      @GoodlyChandeep  Před rokem +2

      the variable name could be anything (r, x, abc, _)
      the variable holds the value of each item of the object (table, list etc..) and can be retrieved using a function =>
      So all of the following are valid
      = Table.AddColumn(Table, "ColName", (abc) => abc)
      = Table.AddColumn(Table, "ColName", (_) => _)
      = Table.AddColumn(Table, "ColName", (myrecord) => myrecord)

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

    General question: any idea how to turn on in MacOs the syntax helper?

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

    can you put certain columns in a record and use it to show info on a regular tooltip? I wanted to show certain info depending on type of data, i had to concatenate columns based on conditions and even set titles for the data, like for data A "info1: " & "[info1)] & " " & "info2: "& [info2]... and so on.

  • @RobertoStaltari
    @RobertoStaltari Před rokem

    This video deserves a double thumb up!

  • @Faisal63045
    @Faisal63045 Před rokem

    Thank you for sharing this, is there a way to track values changes after refresh a power query in excel

  • @yochintomimo5368
    @yochintomimo5368 Před rokem

    👍

  • @sunnygala7972
    @sunnygala7972 Před rokem

    Great video! Do you cover all these concepts in your Power query course?

    • @GoodlyChandeep
      @GoodlyChandeep  Před rokem +1

      working on an exclusive M Language course. Should be out soon :)

  • @KirillBezzubkine
    @KirillBezzubkine Před rokem

    I was wondering what "_" means. But actually i found more convenient to use " (x) =>" construction

  • @LaloinLondon
    @LaloinLondon Před rokem

    Thanks for sharing. Would you mind telling me how could you get amount without using the name 'Amount', just by position?

  • @malchicken
    @malchicken Před rokem +1

    Very well explained thank you😊. When you declared (r) as a variable, could you have declared other variables that *don’t* represent the current record value? How complex can the functions used be? Does the variable always have to represent the current record? 🙏

    • @GoodlyChandeep
      @GoodlyChandeep  Před rokem

      The variable name can be anything but you can only declare a single variable while you are working with records in a table.

    • @Vandalfoe
      @Vandalfoe Před rokem

      I believe that in the content of list.Xform and table.addColumn, that third parameter is being "fed" each (no pun intended) row/item of the first parameter.
      Therefore, whatever variable name you use, it will be loaded with 'each' item. @Goodly, is that about right?

    • @MrDonkey912
      @MrDonkey912 Před rokem +1

      table: `_` is the record of the current row
      List: `_` is the current list item when looping
      Table.SelectRows: `_` is the record of the current row
      You can write your own functions, that validate better
      Here's two examples that assume your table has a column named "Number" which is a number
      = Table.AddColumn(
      Source, "Enforce Text",
      (row) as text =>
      Text.From( row[Number] ) & " ending", type text)
      = Table.AddColumn(
      Source, "Enforce Int",
      (row) as number =>
      row[Number] + 100, type number)
      the `as number` is a type assertion. Either the result is a number, else, that row throws an error.
      plus the columns datatype is correct! It doesn't reset to type any, because `each` is what caused it to lose the type

  • @vadnerepravin
    @vadnerepravin Před rokem

    Question regarding power query
    I have many coulmn like Printing and Stationary 18%, repairing 18%, Consultancy 18% like that
    I want to Addition all this coulmn in Net 18%
    I have more than 200 ledger above said example. I have made table mentioned all ledger in left side like (consultancy 18%) and summation in coulmn right side like (Net18%)
    How can we dynamically addition above coulmn

  • @markhenderson3771
    @markhenderson3771 Před rokem

    Can I add ‘ and null to return a list of lists?

  • @surjaa.c
    @surjaa.c Před rokem

    Thanks a lot for this video! My question is, are each and _ always used together like you have shown or can there be cases where only one of the two is used?

    • @GoodlyChandeep
      @GoodlyChandeep  Před rokem +3

      the underscore can be used in isolation if you're writing a function.
      But if you've used the each keyword, it will always be followed by _

    • @surjaa.c
      @surjaa.c Před rokem

      @@GoodlyChandeep thanks a lot! Please continue the 'good' work you are doing! 😁

  • @Jonbooi
    @Jonbooi Před rokem

    Why can I use the _ as a shorthand for the column name in this formula if the _ holds the whole record?
    = Table.ReplaceValue(Source, each [Colum1], each if [Column1] = "AAA" then _ else "123" ,Replacer.ReplaceText,{"Column1"})

  • @sandeepkhawas3367
    @sandeepkhawas3367 Před 5 měsíci

    Can anyone suggest as getting this while using the same function in power query!
    Expression.Error: We cannot apply operator + to types Text and Number.
    Details:
    Operator=+
    Left=1
    Right=1

  • @gopalnaidu1103
    @gopalnaidu1103 Před rokem

    I have one unsolved query .could you please help me out .if the column contains the data as names and Gmail IDs and #twitter IDs ,and some other like diffent delimeters data .how to seperate the only names to one column and all Gmail IDs ,#twiiter IDs and delimeter data in to other column

  • @gurjar5708
    @gurjar5708 Před rokem

    moj ker de❤

  • @PawanKumar-nh3pi
    @PawanKumar-nh3pi Před 4 měsíci

    1:45

  • @saratoffice
    @saratoffice Před rokem

    My table is inside a login page and the Login credential is known to me please reply on how to bring it to power query.

  • @rashidkhan8161
    @rashidkhan8161 Před rokem

    hi there, Could please help me to solve this, I have simple list Source = {a, b ,c , d}, when I use this List.Transform( Source, each [_=List.PositionOf(Source, _)]) it create list of record but every record showing filed name "_" , _=0, _=1 etc..

    • @gennarocimmino
      @gennarocimmino Před rokem

      try it this way
      let
      Source = {"a", "b", "c" , "d"},
      Custom1 = List.Transform( Source, (r)=> List.PositionOf(Source, r) )
      in
      Custom1

  • @mohamedhakeem2446
    @mohamedhakeem2446 Před rokem

    Sir in my power query formula bar, I'm editing code it's showing only black colour, but your all videos the coding in colour full l. How can I do like this.

    • @TibKo
      @TibKo Před rokem

      It depends on the version of Power Query that you are using. Just a simple example. In my Excel 2019, Power Query is quite plain - just black and white. There is a Power Query module in Power BI as well. That one is much more colorful. 🙂

    • @mohamedhakeem2446
      @mohamedhakeem2446 Před rokem

      @@TibKo thanks sir

  • @SamehRSameh
    @SamehRSameh Před rokem

    This mean that we must use each &_ together ???

  • @rajanpradeepankarath8846
    @rajanpradeepankarath8846 Před 4 měsíci

    It would perhaps be better to understand the relevance if you had put in a practical life scenario on how to use this