Forum Discussion
Replace Value Based on latest date
- 5 years ago
=Table.Combine(Table.Group(Source,"Name",{"n",each let NewLocation=Table.First(Table.Sort(_,{"Date",1}))[Location] in Table.ReplaceValue(_,null,NewLocation,(x,y,z)=>z,{"Location"})})[n])
=Table.Combine(Table.Group(Source,"Name",{"n",each let NewLocation=Table.First(Table.Sort(_,{"Date",1}))[Location] in Table.ReplaceValue(_,null,NewLocation,(x,y,z)=>z,{"Location"})})[n])
Hello, thank you for the very helpful formula! I have the exact same issue as eyespike1, and this forum has been a blessing.
One stumbling block I have encountered: Are you able to advise on excluding nulls as the most recent value? Example:
In this scenario, I want:
Somebody's locations would be Location3
Somebody2's locations would be Location6
Somebody3's locations would be Location12
Edit: The only option I have found is adding a helper column that tags rows w/ number in "Location" as "1" and nulls as "2". Then modifying the Table.Sort step to sort by both the helper column and Date column. Is the the only / best way?
thank you!