I am pretty new to PowerBI and DAX, so I really appreciate the help here. I did a search, and while there were many examples of moving averages I did not see anything that matched my situation exactly.
Basically I have two values in two different columns that I want to add together, and then calculate an average based on the last three months. To do this I am currently using this formula to create the measure, which seems to be working:
The problem is that this method includes months with 0 sums of Count1 and Count2. The data looks something like this:
In cases where the SUM of Count1 and Count2 for a given month equal 0, I want to exclude this month/record from the average calculation. For example in the data above, rather than calculating the average for the last three months for Client1, I want to pretend that Month 2 does not exist. Averaging Months 1 & 3 instead. This will still be considered the average for the last three months.
I think what I need here is some kind of IF statement that will determine whether to divide by 1, 2, 3, etc, but I'm not sure how to implement that correctly.
Hopefully that makes sense. If more clarification is needed please just let me know.