M Code Flashcards
Text.split
text.split([Column Name],” “) -> return a list
Comment
//
/* multi-line */
manual input a list
= {“A”,”B”}
pick a column and turn it to a list
click on
last_step[Column name]
or
select column -> right click -> drill down / add as new query”
distinct list
list.distinct
or just click remove duplicates”
Filter list
List.Contains
= Table.SelectRows(#”Last Step”, each List.Contains(Filter_list, [Field in table])= true )
normall add as new custom column first, then change it to SelectRows
List.Buffer
no need to reload the filter condition for every row but it should be outside of the “each” iteration, i.e. add a step to read in the buffered list before using it
List.Buffer ( List A)
List Naming
list better not start with a number => otherwise need to use #”Field ABC” instead of just Field_ABC
Table.Selectrows
Table.Selectrows(Table, each condition)
get a list at source step (drill down)
using “Field Access Operator” [Field]
List.IsEmpty and List.Intersect
List.IsEmpty(List.Intersect({Text.Split([Product_Name],” “),NOT_filter}))
Query and Field convention
If the query/step is properly named (i.e. not start with a number and no space), just use it directly.
If it is not properly named, use #”Table A”
Field uses []
List use curly {}
Extracting Current workbook Name range as string
Excel.CurrentWorkbook(){[Name=”Table_6_DyanmicPathInput”]}[Content][Column1]{0}
and or condition
Table.SelectRows(#”Changed Type”, each ([Con1]= “A” and [Con2]=”B”) or [Con3]=”C”)