Forum Discussion

vs531's avatar
vs531
New Member
3 years ago
Solved

Apply filter on CURRENTGROUP

Hi  I am trying to calculate the difference between the last and previous observations for each ID. In the dataset, I have multiple observations for each ID over time. As a first step, I want to cre...
  • amitchandak's avatar
    3 years ago

    vs531 , In case you need a new column

     

    Diff =

    var _max = maxx(filter(Table, [ID] = earlier([ID]) && [Date] < earlier([Date]) ) , [Date])
    return
    [Score]- Maxx(filter(Table, [ID] = earlier([ID]) && [Date] =_max ) , [Score])