Forum Discussion
Anonymous
3 years agoNot applicable
PowerBI - max record with min date
Hi
I have the table attached and I want to have the output table attached.
Power BI has to get the last owned vehicle by person and then get when it was owned.
Hi
let
Source = YourSource,
FillDown = Table.FillDown(Source,{"Name"}),
Type = Table.TransformColumnTypes(FillDown,{{"Date owned", type date}}),
Group = Table.Group(
Type,
{"Name", "Own"},
{{"Max", each List.Max([Date owned]), type nullable date},
{"Since", each List.Min([Date owned]), type nullable date}},
GroupKind.Local),
Sort = Table.Sort(Group,{{"Max", Order.Descending}}),
Distinct = Table.Distinct(Sort, {"Name"})
in
DistinctStéphane
1 Reply
- slorinSuper User
Hi
let
Source = YourSource,
FillDown = Table.FillDown(Source,{"Name"}),
Type = Table.TransformColumnTypes(FillDown,{{"Date owned", type date}}),
Group = Table.Group(
Type,
{"Name", "Own"},
{{"Max", each List.Max([Date owned]), type nullable date},
{"Since", each List.Min([Date owned]), type nullable date}},
GroupKind.Local),
Sort = Table.Sort(Group,{{"Max", Order.Descending}}),
Distinct = Table.Distinct(Sort, {"Name"})
in
DistinctStéphane