Forum Discussion
Group By
- 1 year ago
Hi AndreaLH , is this what you are looking for?
If this is similar to what you'd like to achieve, I'll share a snippet of the M code for reference.
In this partcular scenario, I've taken just the Member name column for the text column. In case you wish to take more columns and combine them, I'll leave the code for that below. (Use another nested list in Grouping Function and use the below function)
List.Transform(Table.ToColumns(Table.RemoveColumns(_,NumericCols)), each Text.Combine(_,",")). Thanks
This is more understandable for me so thank you. The M code was automatically generated as I went through
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Member Name", type text}, {"Member’s Humana ID", Int64.Type}, {"Claim Number", Int64.Type}, {"Claim Status", type text}, {"Line of Business", type text}, {"Provider Name", type text}, {"Provider Tax ID", Int64.Type}, {"National Provider Identifier", Int64.Type}, {"Provider Status", type text}, {"Billed Amount", Int64.Type}, {"Amount Paid", Int64.Type}, {"Interest Amount Paid", Int64.Type}, {"MIPS Bonus Amount Paid", Int64.Type}, {"Denial Reason Code or Description", type text}, {"CPT/revenue/HCPCS Code", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Claim Number"}, {{"Billed Amount Total", each List.Sum([Billed Amount]), type nullable number}, {"Amount Paid Total", each List.Sum([Amount Paid]), type nullable number}, {"Interest Amount Total", each List.Sum([Interest Amount Paid]), type nullable number}, {"MIP Bonus Amount Paid Total", each List.Sum([MIPS Bonus Amount Paid]), type nullable number}, {"Aggregate", each _, type table [Member Name=nullable text, #"Member’s Humana ID"=nullable number, Claim Number=nullable number, Claim Status=nullable text, Line of Business=nullable text, Provider Name=nullable text, Provider Tax ID=nullable number, National Provider Identifier=nullable number, Provider Status=nullable text, Billed Amount=nullable number, Amount Paid=nullable number, Interest Amount Paid=nullable number, MIPS Bonus Amount Paid=nullable number, Denial Reason Code or Description=nullable text, #"CPT/revenue/HCPCS Code"=nullable text]}}),
#"Expanded Aggregate" = Table.ExpandTableColumn(#"Grouped Rows", "Aggregate", {"Member Name", "Member’s Humana ID", "Claim Number", "Claim Status", "Line of Business", "Provider Name", "Provider Tax ID", "National Provider Identifier", "Provider Status", "Billed Amount", "Amount Paid", "Interest Amount Paid", "MIPS Bonus Amount Paid", "Denial Reason Code or Description", "CPT/revenue/HCPCS Code"}, {"Member Name", "Member’s Humana ID", "Claim Number.1", "Claim Status", "Line of Business", "Provider Name", "Provider Tax ID", "National Provider Identifier", "Provider Status", "Billed Amount", "Amount Paid", "Interest Amount Paid", "MIPS Bonus Amount Paid", "Denial Reason Code or Description", "CPT/revenue/HCPCS Code"}),
#"Added Custom" = Table.AddColumn(#"Expanded Aggregate", "New Member Name", each Text.Combine(List.Distinct(List.Transform([All Rows], each Record.Field(_, "Member Name"))), ", "))
in
#"Added Custom"Hi AndreaLH
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.