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 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.
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
@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.
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,
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
i tried above forumala but it always return as 1 only instead of rolling average
@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.
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
i tried already above formula still returns same values for base value
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 |
---|---|
121 | |
87 | |
78 | |
62 | |
58 |
User | Count |
---|---|
129 | |
114 | |
97 | |
72 | |
71 |