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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hey All,
I'm trying to calculate the average value of a measure [Net Reserve] over the past three months.
The below code works but is cumbersome, and would not scale well to formulas that involve more variables/bigger time periods.
Average Net Reserve (3mo) = CALCULATE(
CALCULATE([Net Reserve],PREVIOUSMONTH(Reserve[Month]))+
CALCULATE([Net Reserve],PREVIOUSMONTH(PREVIOUSMONTH(Reserve[Month])))+
CALCULATE([Net Reserve],PREVIOUSMONTH(PREVIOUSMONTH(PREVIOUSMONTH(Reserve[Month]))))
)/3)
Any help to optimize this type of calcualtion?
According to your description, you want to calculate the moving average for past three months. Right?
In this scenario, you can use DATESINPERIOD() function as filter in CALCULATE() to get the 3 month moving total, then divide by three to get the average.
[3 Month Moving Average] =
CALCULATE(SUM(Table[Net Reserve]),
DATESINPERIOD(Reserve[Date],
LASTDATE(Reserve[Date]),-3, Month
)
)
/3
For more details, please refer to blogs below:
Rolling 12 Months Average in DAX
Regards,
That calculates the moving average of a column though does it not? [Net Reserve] is a measure in my model.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 39 | |
| 37 | |
| 29 | |
| 24 |
| User | Count |
|---|---|
| 122 | |
| 110 | |
| 83 | |
| 69 | |
| 68 |