Forum Discussion
Cliff09
8 years agoRegular Visitor
12 Month Rolling average.
Hi, I have been asked to show our monthly sales with a moving average in a table (and chart). Here is some sample data: Sale Date Sale Amount 2/07/2017 $15,000 11/07/2017 $20,000 ...
Anonymous
7 years agoNot applicable
Hi jmf2244
This is 10 days rolling average I used on one of my reports and it works well according to your issue.
kindly find the example attached and please let me know if it works:
Revenue rolling average =
CALCULATE(IF([Revenue]<>BLANK();
VAR __LAST_DATE = LASTDATE('Date'[Date].[Date])
RETURN
AVERAGEX(
DATESBETWEEN(
'Date'[Date].[Date];
DATEADD(__LAST_DATE; -10; DAY);
DATEADD(__LAST_DATE; 1; DAY)
);
CALCULATE([Revenue])
)
))
jmf2244
7 years agoNew Member
Thanks Anonymous . However, I am getting the following error: "A single value for column 'Revenue' in table 'xxxx' cannot be determined." (I replaced "Revenue" and "xxxx" with the real names to follow your example)
It seems like IF needs a single value in the logical test, not a table, right?
- Anonymous7 years agoNot applicable
Hi jmf2244
try referring to the article as attached:https://community.powerbi.com/t5/Desktop/Rolling-Average-Quick-Measure-Incorrectly-Calculating-the-Future/td-p/258616