Forum Discussion

IEPMost's avatar
IEPMost
Helper III
5 years ago

Group multiple columns except one

Hi guys,

 

is it possible to group two columns into a list and keep one as it is in one step (in Power Query)?

 

i.e.: I have three columns [Date], [Sales], [CustomerID]; in the next step I want [Sales] and [CustomerID] in one List as a new column and [Date] as the second column?

 

Hope you know what I mean!:)

Cheers

5 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Hi IEPMost ,

     

    It's possible having a list of tables with those 2 columns. However you can't use it on your visuals.

    Can you explain more about what you are trying to achieve ?

    • IEPMost's avatar
      IEPMost
      Helper III

      Hi camargos88 ,

       

      thanks for your quick response!!

       

      I want to transform two of the columns ([CustomerID] and [Sales]) into a third column, which should display a list. In the same step I want to keep the column [Date].

       

      This is my Code (you can ignore the if condition):

      = Table.Group(#"Changed Type", {"CustomerID", "Sales"}, {{"ERROR", each List.Transform(List.Numbers(1,Table.RowCount(_)), each if _ = 1 then "GO" else "Error"), type list}})

       

      So how can I keep the column [Date] without grouping it with [CustomerID] and [Sales]?

       

      Thanks a lot!!:)

      • camargos88's avatar
        camargos88
        Community Champion

        IEPMost ,

         

        Can you provide an example of the input and desired output ?

         

        Thanks