Power Query - M (Table. Select)

In your video on Creating Records For Daily Values With Power Query [Creating Records For Daily Values With Power Query | Enterprise DNA]

Creating Records For Daily Values With Power Query | Enterprise DNA

Require clarification in the following M Code

Table.SelectRows(BufferedTable, (BT)=> BT[ID]= _[ID]and BT[Date]>= _[Date] ))

Table.SelectRows requires only two parameters table and condition as function. The above code compares the current record with the Buffered table .

My question is how does the buffered table gets **automatically assigned to the variable BT in the function (BT) =>, before comparing with current record held by _(underscore)

The function starts comparing the selected columns of the buffered with the current record

@Sairam

Table.SelectRows(BufferedTable, (BT)=> BT[ID]= _[ID]and BT[Date]>= _[Date] ))

()=> is a custom function that doesn’t accept a parameter
(BT)=> is a custom function that accepts a parameter of any type, since BufferedTable is on left it is automatically passed as an argument to this function

more explicitly it passes a record, row by row.
(BT as record ) => is a custom function that accepts a value of type record.

()=> equals each

1 Like

Thanks @AntrikshSharma
(_)=> invokes Current record ; variable name can also be used in lieu of _underscore .

Hence I was amazed as to how automatic assignment of BufferedTable to the left,is passed as an argument to the function (BT)=>

M is the new paradigm of using codes to extinguish codes. @Melissa is the God of M code.

1 Like

Bumping this post for more visibility.

Hi @Sairam! We noticed that your inquiry was left unsolved for quite some time now.

Looks like your inquiry was out of the experts and users’ bounds.

We strive to answer ALL inquiries in the forum. However, if you are sure that you provided all pertinent context to your concerns and read how to use the forum more effectively and still find your question unanswered, you can check out tutorials to learn this yourself as your membership also comes with relevant resources that may help you with your Power BI education.

While our users and experts do as much as reasonable to help you with your inquiries, not all concerns can be attended to especially if there are some learnings to be done. Thank you!