Please follow the @Greg_Deckler said, filter the table using the highest value of a variable called "Period". Then use the filter table in your formula, don't hesitate to ask if you have any other issue.
An embarrasing fault from my side. The solution that @Greg_Deckler works just fine. I should have replaced the comma with a semicolon, which I didn't do at first. So please accept my apologies. Thanks a lot. It runs beautifully now!