Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Adavanced Editor help

I have the following code which takes population data, groups it by field of study and catches only those that are 500K or higher. 

Is there a way to do this, so that the filtered table is not grouped, in other words still showing all of the rows and colums before the grouping occured? Thanks in advance!

 

#"Grouped Rows" = Table.Group(#"Sorted Rows", {"Major Field of Study"}, {{"Field Total", each List.Sum([Value]), type number}}),
#"Filtered Rows1" = Table.SelectRows(#"Grouped Rows", each [Field Total] >= 500000)

  • ImkeF's avatar
    ImkeF
    7 years ago

    While Dales solution will work, on large volume of data it might soon become slow. Then you can use this technique instead: Just add another column in your Group-operation, that adds all the rows back as they were and expand that column afterwards: 

     

     

    Happy and healthy new year everyone :)

4 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi Anonymous,

     

    It seems you'd like to add a column. Please try the formula below. 

    let current = [Major Field of Study] in List.Sum(Table.SelectRows(#"Sorted Rows", each [Major Field of Study] = current)[Value])

    Adavanced-Editor-help

     

     

    Best Regards,
    Dale

    • ImkeF's avatar
      ImkeF
      Community Champion

      While Dales solution will work, on large volume of data it might soon become slow. Then you can use this technique instead: Just add another column in your Group-operation, that adds all the rows back as they were and expand that column afterwards: 

       

       

      Happy and healthy new year everyone :)

      • Anonymous's avatar
        Anonymous
        Not applicable

        Thank you guys for taking the time to respond to this - I will try out both of these solutions.