Reputation: 1036
I have data like this in Power Query:
And I'd like to create a new column that is true/false. It's TRUE if a patient's most recent status date is associated with their "On Followup", i.e. they are currently on followup.
So for instance the new column would look like this:
Where Bob and Joe are true, but Tiffany and John are false. John has never been on followup, and Tiffany was but its not her most recent status.
Upvotes: 0
Views: 488
Reputation: 21413
One way
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Grouped Rows" = Table.Group(Source, {"Name"}, {{"data", each _, type table } ,{"status" ,each if Table.Sort(_,{{"Status_Date", Order.Descending}}){0}[Status] = "On Followup" then true else false } }),
#"Expanded data" = Table.ExpandTableColumn(#"Grouped Rows", "data", {"Status", "Status_Date"}, {"Status.1", "Status_Date"}),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded data",{{"Status_Date", type date}})
in #"Changed Type"
Upvotes: 2