- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

rolling average for 3 months showing same value
Hi team,
i am trying to create the rolling average for 3 months but it was giving same values as base value, can you help me to fix for rolling average for 3 months.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

You can try
Rolling Average =
VAR DatesToUse =
WINDOW (
-2,
REL,
0,
REL,
ALLSELECTED ( 'Date'[Year], 'Date'[Month number] ),
ORDERBY ( 'Date'[Year], ASC, 'Date'[Month number], ASC )
)
VAR Result =
AVERAGEX ( DatesToUse, CALCULATE ( DISTINCTCOUNT ( 'Table'[User ID] ) ) )
RETURN
Result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello @sreddy47652 ,
You can use below dax for your purpose , please replace table names and fileds:
Did I answer your query ? Mark this as solution if this helps, appreciate your Kudos.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello @sreddy47652 ,
It is giving as expected , here is the illustration, please suggest if you have different logic
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @sreddy47652 ,
Please try the following dax.
Rolling Average (3 Months) =
VAR difference = DATEDIFF(MINX(ALL('Table'),'Table'[Date]),MAX('Table'[Date]),MONTH) --The difference in months from the min date.
VAR _value = CALCULATE(DISTINCTCOUNT('Table'[Users]) ,DATESINPERIOD('Table'[Date],MAX('Table'[Date]),-3,MONTH)) --Total value of 3 months.
RETURN
SWITCH(
TRUE(),
difference=0,_value,
difference=1,_value/2,
difference>1,_value/3
)
Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @sreddy47652 ,
Please try the following dax.
Rolling Average (3 Months) =
VAR difference = DATEDIFF(MINX(ALL('Table'),'Table'[Date]),MAX('Table'[Date]),MONTH) --The difference in months from the min date.
VAR _value = CALCULATE(DISTINCTCOUNT('Table'[Users]) ,DATESINPERIOD('Table'[Date],MAX('Table'[Date]),-3,MONTH)) --Total value of 3 months.
RETURN
SWITCH(
TRUE(),
difference=0,_value,
difference=1,_value/2,
difference>1,_value/3
)
Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello @sreddy47652 ,
You can use below dax for your purpose , please replace table names and fileds:
Did I answer your query ? Mark this as solution if this helps, appreciate your Kudos.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@divyed it's working some what better than earlier formulas but need rolling average like this below image, can you help me to fix this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello @sreddy47652 ,
It is giving as expected , here is the illustration, please suggest if you have different logic
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @sreddy47652 ,
Here is a measure for calculating a 3-month rolling average at the month level:
Rolling Average (3 Months) =
VAR CurrentMonth = MAX('Calendar'[Date])
RETURN
AVERAGEX(
DATESINPERIOD('Calendar'[Date], CurrentMonth, -3, MONTH),
CALCULATE(SUM('FactTable'[Value]))
)
This measure calculates the rolling average by using the DATESINPERIOD function to define a 3-month window and then applies AVERAGEX to compute the average for the specified period. The calendar table ensures the calculation respects the relationship with the fact table.
Best regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

You can try
Rolling Average =
VAR DatesToUse =
WINDOW (
-2,
REL,
0,
REL,
ALLSELECTED ( 'Date'[Year], 'Date'[Month number] ),
ORDERBY ( 'Date'[Year], ASC, 'Date'[Month number], ASC )
)
VAR Result =
AVERAGEX ( DatesToUse, CALCULATE ( DISTINCTCOUNT ( 'Table'[User ID] ) ) )
RETURN
Result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

i tried above forumala but it always return as 1 only instead of rolling average
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

@johnt75 it seems better than earlier formula but its not giving accurate results, i need rolling average below like this but based on month number. can you help me how to fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Its is showing the rolling 3 month average, including the month itself. So in March it is showing the average over Jan, Feb and March.
What formula are you using to calculate the average, and what about the numbers do you think is wrong ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

No ,Formula is correct but when you rolling over next month it's showing average for 4 months viceversa but ideally it should show as below image
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I don't understand what you mean that its showing the average for 4 months viceversa? The window function is producing 3 months and then you take the average of that.
From the PBIX I posted earlier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @sreddy47652
It is better to provide representative date to get the exact solution.
However, you could try this:
RollingAvg3Months =
CALCULATE(
AVERAGEX(
DATESINPERIOD(
'DateTable'[Date],
LASTDATE('DateTable'[Date]),
-3,
MONTH
),
AVERAGE('YourTable'[Value])
)
)
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

i tried already above formula still returns same values for base value

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
07-28-2024 10:29 AM | |||
01-29-2024 09:21 AM | |||
08-09-2022 10:06 AM | |||
04-03-2023 06:36 AM | |||
10-23-2023 07:53 PM |