Power Query Grouping By

I have a Power Query from a table.  As I am still learning about what Power Query can do I am struggling with Grouping.

What I am trying to do is:

Group by Customer, by level 1, show the earliest date requested for all categories (in this case 2), lastest date updated by level 1, total quantity received by level 1.

If I can get help with putting together this bit, I will be able to work out everything else I need to do with this Power Query table.

I have attached a file containing test data.

I appreciate any help you can give me,
Sonia BowditchInformation Security OfficerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShumsExcel & VBA ExpertCommented:
Hi Sonia,

Have you tried creating Pivot Table? From Report you can select Level to list all the customers and their data field (please see attached). If you still wants grouping then please refer Group rows in a table (Power Query) or Grouping or Summarizing Data

Once you created groups, then select the group name in Pivot and in Formula Bar, change Level to desired name

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sonia BowditchInformation Security OfficerAuthor Commented:
Hello Shums,

Thanks for getting back to me.

I have attached an example of what I am trying to achieve with the Power Query, shown on Sheet 2.  The area I am struggling with is the dates as I can work out to do total of fields.

Over a month old, my guess is you have found a solution.
I think this is the Power Query M solution you seek:

    Source = Excel.CurrentWorkbook(){[Name="PQ_Test"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"customer", type text}, {"level_1", type text}, {"date_request", type datetime}, {"dt_created", type datetime}, {"last_updated", type datetime}, {"price", type number}, {"net_value", type number}, {"vat_value", type number}, {"total_value", type number}, {"qty_req", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"customer", "level_1"}, {{"Earliest date_request", each List.Min([date_request]), type datetime}, {"Last last_updated", each List.Max([last_updated]), type datetime}, {"Sum qty_req", each List.Sum([qty_req]), type number}})
    #"Grouped Rows"

Open in new window

Sonia BowditchInformation Security OfficerAuthor Commented:
Perfect, thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.