Forum Discussion

SebSchoon1's avatar
SebSchoon1
Post Patron
4 years ago
Solved

Dynamic Table.GROUP with Dynamic List.Sum

Hello Guys,

 

New Challenge today

 

Table.Group(#"My Whole Table",#"List of columns not to aggregate",List.Sum(#"List of columns i want to aggregate") As Whole Number)

Is there a way to do this?

Data i would like not to aggregate.

 

Data i would like to aggregate

Dynamic sum of column 

3 Replies

  • Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. Avoid posting screenshots of your source data if possible.

    Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

    https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

    • SebSchoon1's avatar
      SebSchoon1
      Post Patron

      Hello, I just succeeded on Friday end of the work day. I'll post my solution and the source which has been used for! 

       

      Thanks guys for your huge content!

  • Hey Guys,

     

    Here the answer !

     

    I have found this on the internet and adapted to my Case

    https://stackoverflow.com/questions/65342143/power-query-table-group-with-a-dynamic-list-of-aggregated-columns

     

    This adapted to my situation is 

     

    = Table.Group(#"Lignes triées", #"Lignes filtrées1", List.Transform(#"Detection des Tailles 11 On garde une liste", (C)=> {C, each List.Sum(Table.Column(_,C)), Int64.Type}))

    in simple words

    = Table.Buffer(Table.Group(#"Step in which i need this", #"List of columns i want to keep", List.Transform(#"List of columns i want to aggregate", (C)=> {C, each List.Sum(Table.Column(_,C)), Int64.Type})))

     

     

    You're the gods guys!