Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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 |
19/07/2017 | $4,000 |
21/07/2017 | $4,000 |
21/07/2017 | $60,000 |
2/08/2017 | $21,000 |
3/08/2017 | $15,000 |
19/08/2017 | $5,500 |
19/08/2017 | $15,000 |
29/08/2017 | $20,000 |
29/08/2017 | $4,000 |
1/09/2017 | $10,000 |
15/09/2017 | $15,000 |
17/09/2017 | $5,500 |
18/09/2017 | $15,000 |
25/09/2017 | $20,000 |
2/10/2017 | $4,000 |
5/10/2017 | $60,000 |
12/10/2017 | $21,000 |
26/10/2017 | $8,000 |
28/10/2017 | $11,000 |
28/10/2017 | $500 |
28/10/2017 | $15,000 |
It is simple to display the monthly totals, but I am stuck getting the rolling average to work. I have tried messing with a number of DAX expressions that solved similar problem on the forums but can't find exactly what I need.
This is the result I am after:
Sale Month | Total Monthly Sales | 12 Month Moving Average |
Jul-17 | $103,000 | |
Aug-17 | $80,500 | |
Sep-17 | $65,500 | |
Oct-17 | $119,500 |
Thanks,
Cliff
Solved! Go to Solution.
Apologise for the late response. Addressed your issue.
Here is the solution,
Step 1: Create a quick measure -> Rolling average
Step 2: Edit the DAX of the quick measure -> Change AVERAGEX to SUMX
That's it
Hi All,
I don't see 'Rolling average' in Quick measure. Is it removed/deprecated?
--
Yours
I do the rolling average and the result is ok. But when I graph the measure in a timeline, it shows datapoints into the future. E.g., let's say my data ends on 4/1/19 and I calculate a 10-day rolling average. The timeline goes up to 4/11/19, i.e. 10 days after my last data point. How can I make my graph end on 04/01/2019?
I would really appreciate help on this!
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:
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?
Hi @jmf2244
try referring to the article as attached:https://community.powerbi.com/t5/Desktop/Rolling-Average-Quick-Measure-Incorrectly-Calculating-the-F...
I do the rolling average and the result is ok. But when I graph the measure in a timeline, it shows datapoints into the future. E.g., let's say my data ends on 4/1/19 and I calculate a 10-day rolling average. The timeline goes up to 4/11/19, i.e. 10 days after my last data point. How can I make my graph end on 04/01/2019?
I would really appreciate help on this!
hi, i have been using quick measures to calculate rolling average of the last 3,6,12 and 18 months to generate the rankings at work, for some odd reason the averages dont work anymore since we are in a new year, can someone help i am stuck
Can you share more detail about your issue with sample data?
Try this and let me if it's working or not,
Sales Value L12M =
VAR __EndDate = EOMONTH(LASTDATE(‘Sales’[Date]),0)
VAR __StartDate = DATE(YEAR(__EndDate),MONTH(__EndDate) - 12,1)
RETURN
CALCULATE(SUM(‘Sales’[Value]), DATESBETWEEN(‘Sales’ [Date], __StartDate, __EndDate))
Hi SivaMani,
That is just repeating the value from the 'Total Monthly Sales' Column.
If you create this as a calculated column, it repeats the value.
Please, create as a calculated measure.
Yes, I have created it as a measure.
Here is the result I get on the sample data:
Apologise for the late response. Addressed your issue.
Here is the solution,
Step 1: Create a quick measure -> Rolling average
Step 2: Edit the DAX of the quick measure -> Change AVERAGEX to SUMX
That's it
This is what i need thanks. Trying to get this to ignore an external slicer for geography though - i'm guessing i'm missing and ALL somewhere or something?
Hi SaviMani,
Thanks that did the trick. Although leaving it as AVERAGEX gives me that result I am after.
I do run a "Can't display the vidual." error when I try to apply date slice to the page and I have sent off a 'frown' to Microsoft support for this.
Thanks for your help!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
86 | |
83 | |
65 | |
49 |
User | Count |
---|---|
127 | |
108 | |
89 | |
70 | |
66 |