Define = number of paths from to cell ij. This is clean and intuitive. Each cell stores how many ways you can reach it. The answer is .
Notice: you don't need to track which path you took. You only care about how many paths reach each cell. The DP state (what represents) must capture everything needed to solve the subproblem. If you are missing information, you cannot compute the answer correctly. If you include too much, your solution will be slow or use too much memory.