Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
I want to know how we write the Dax code in Rolling of average sales without use of averagex function in easiest way.
can you please help here.
Solved! Go to Solution.
@nknishant , if you need row level avg
Rolling 12 = CALCULATE(Average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
if not
Rolling 12 Avg = CALCULATE(Divide( sum(Sales[Sales Amount]) , distinctcount('Date'[Month Year]) ) ,DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
or
Rolling 12 Avg = CALCULATE(Divide( sum(Sales[Sales Amount]) , countrows(sumamrize(Sales,'Date'[Month Year]) ) ,DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
Hi,
Why do you not want to use the AVERAGEX() function? Share some data to work with and show the expected result.
Thank you for the reply soon.👍
Hi,
Why do you not want to use the AVERAGEX() function? Share some data to work with and show the expected result.
Thank you @Ashish_Mathur AverageX we can also use here for the same but as per solution of row level wise.
so we using here calculate with expression and use Datesinperiod for the result.
Thank you for the prompt reply. I will follow this dax method.
@nknishant , if you need row level avg
Rolling 12 = CALCULATE(Average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
if not
Rolling 12 Avg = CALCULATE(Divide( sum(Sales[Sales Amount]) , distinctcount('Date'[Month Year]) ) ,DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
or
Rolling 12 Avg = CALCULATE(Divide( sum(Sales[Sales Amount]) , countrows(sumamrize(Sales,'Date'[Month Year]) ) ,DATESINPERIOD('Date'[Date],MAX('Date'[Date]),-12,MONTH))
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 23 | |
| 20 | |
| 18 | |
| 14 |
| User | Count |
|---|---|
| 58 | |
| 51 | |
| 41 | |
| 30 | |
| 24 |