This is the closest I can get to coming up with a solution with the information you have provided. Let me know if this works for you. If not, you need to provide an Excel sheet with the data that is in the model with the expected result. Here is the link that I tried to get as close as I could to replicating how they solved the EMA: