Forum Discussion

Dicken's avatar
Dicken
Icon for Post Prodigy rankPost Prodigy
1 year ago
Solved

Function within List.Generate

Hi,  I have to grouped accumulations ;  A ; which does not work ;  = Table.Group(Source, {"Name", "Item"},                       {{"Count", each                              List.Generate( ()=...
  • ronrsnfld's avatar
    1 year ago

    You have it correct.

  • ZhangKun's avatar
    1 year ago

    The each keyword is a syntax sugar, which is a shorthand form of "(_) =>". In the first case, only the each keyword is used. The program will find whether there is a Unit column in the variable (identifier) ​​named "_" in the nearest layer.

    The key point is:

    • The function in the first parameter has no parameters, so the Unit column can be found (there is no variable named _ at the current level, so it will be looked for outside).
    • The next three parameters all use the each keyword, which uses _ as the name, so [Unit] in them cannot find the Unit column (looking for the nearest variable named _).