Forum Discussion

cottrera's avatar
cottrera
Post Prodigy
3 years ago
Solved

Grouping issue

Hi Community 

 

I have a table like this one below

Required ActionInput DateTest GradeOverall ActionUnit ReferenceEstate Test
NONE06/07/2023DN65335Cleaning
NONE23/06/2023UN65335Grounds Maintenance
NONE06/07/2023DN65335Grounds Maintenance
NONE01/06/2023CN65335Cleaning
NONE01/06/2023CN65335Grounds Maintenance
NONE07/07/2023CN65369Cleaning
NONE09/06/2023UN65369Cleaning
NONE30/06/2023UN65369Cleaning
NONE30/06/2023UN65369Grounds Maintenance
NONE19/06/2023UN65369Grounds Maintenance
NONE09/06/2023UN65369Grounds Maintenance
NONE07/07/2023CN65369Grounds Maintenance
NONE02/06/2023CN65369Cleaning
NONE02/06/2023CN65369Grounds Maintenance
NONE02/06/2023UN65385Cleaning
NONE09/06/2023UN65385Grounds Maintenance
NONE19/06/2023UN65385Grounds Maintenance
NONE02/06/2023UN65385Grounds Maintenance
NONE30/06/2023UN65385Cleaning
NONE09/06/2023UN65385Cleaning
NONE19/06/2023UN65385Cleaning
NONE07/07/2023CN65385Cleaning
NONE07/07/2023CN65385Grounds Maintenance
NONE30/06/2023UN65385Grounds Maintenance

 

I would like to group it in powert query so that the maximum Input date line is displayed.

The example below is how I would like to result to look like.

 

Unit ReferenceEstate TestInput DateTest GradeRequired Action
65335Cleaning06/07/2023DNONE
65335Grounds Maintenance23/06/2023UNONE
65369Cleaning07/07/2023CNONE
65369Grounds Maintenance07/07/2023CNONE
65385Cleaning07/07/2023CNONE
65385Grounds Maintenance07/07/2023CNONE

 

I have tried this method 

 

 

but the results are wrong

 

Richard

 

  • You can use this as your Group step

    = Table.ExpandRecordColumn(Table.Group(#"Changed Type", {"Unit Reference", "Estate Test"}, {{"Input Date", each List.Max([Input Date])}, {"All", each Table.Max(_, {"Input Date"})[[Test Grade], [Required Action]]}}), "All", {"Test Grade", "Required Action"}, {"Test Grade", "Required Action"})

2 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    You can use this as your Group step

    = Table.ExpandRecordColumn(Table.Group(#"Changed Type", {"Unit Reference", "Estate Test"}, {{"Input Date", each List.Max([Input Date])}, {"All", each Table.Max(_, {"Input Date"})[[Test Grade], [Required Action]]}}), "All", {"Test Grade", "Required Action"}, {"Test Grade", "Required Action"})