Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hello,
I have a data table with something that looks like this.
and I want to create a measure that will allow me to create a matrix table that display the 3 month rolling average for each month, that looks something like this:
I have tried so many formulas looking at similar posts and even asking AI but no luck. I keep getting the same result where each period column displays the average of all transactions in its own month. or where it would display the sum of each month and the grand total would display the average of the latest 3 months of the entire data set.
any help is appreciated.
Thanks,
HI @kyen27 ,
you can try this formula
3M moving avg 2 =
var period = DATESINPERIOD('Calendar'[DateKey],MAX('Calendar'[DateKey]),-3,MONTH)
var sales = CALCULATE([total_sales],period)
VAR month_ = CALCULATE(DISTINCTCOUNT('Calendar'[MonthOfYear]),period)
RETURN
DIVIDE(sales,month_)
If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.
Hello,
thank you for your response but i dont have a date column.
@kyen27 Create a measure
DAX
3MonthRollingAvg =
CALCULATE(
AVERAGEX(
DATESINPERIOD(
'Table'[Period],
LASTDATE('Table'[Period]),
-3,
MONTH
),
'Table'[Amount]
)
)
Proud to be a Super User! |
|
Hello, i get an error saying this:
User | Count |
---|---|
11 | |
9 | |
6 | |
5 | |
4 |