Forum Discussion

gavin007's avatar
gavin007
Helper V
5 years ago
Solved

invalid identifier for list.sum syntax

Hi, I use group by window to sum Rev Act and GM Act by InvoiceDate and OrderNo_Revised_Item. it all works well until I try to amend the sum of Rev Act by applying a condition in when evaluating the source, which is [I/C]="C". (highlight in bold), I got an error message like invalid identifier.

 

= Table.Group(Source, {"InvoiceDate", "OrderNo_Revised_Item"}, {{"Ext Rev Act", each List.Sum(Table.SelectRows(Source, each [I/C]="C") [Rev Act]), type nullable number}, {"GM Act", each List.Sum([GM Act]), type nullable number}})

 

 

I couldn't figure out what is wrong with that. Can anyone help?

  • ImkeF's avatar
    ImkeF
    5 years ago

    Hi gavin007 ,

    yes, I didn't pay attention to the other code. Problem is, that you have used the "each"-keyword twice and now the syntax sugar doesn't know what to refer to.

    Therefore I'd recommend to transform at least one of the functions to the explicit syntax:

     

    Table.Group(Source, {"InvoiceDate", "OrderNo_Revised_Item"}, {{"Ext Rev Act", each List.Sum(Table.SelectRows(Source, (row) => row[#"I/C"]="C") [Rev Act]), type nullable number}, {"GM Act", each List.Sum([GM Act]), type nullable number}})

     

8 Replies

    • ImkeF's avatar
      ImkeF
      Community Champion

      Hi gavin007 

      that's probably due to the special characters in the field name. Try to escape it like so: [#"C/O"].

       

      • gavin007's avatar
        gavin007
        Helper V

        ImkeF It partialy work but it then it has error message like "We cannot convert the value 380000 to type Function."

        Is there something wrong with the type?