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.
Hi,
I have recently started using powerBI. So I need your help to sort my issues.
The issue is in rolling average calculation where from raw data, i constructed a pivot.
My expected output is based on pivot and it is basically moving average of 2months.
I tried in PowerBI using a measure but values are wrong.
Hierarchy is like this Region>Priority Setting>Performance>Docket#(not used in Pivot)>Risk score. Let me know how to tackle this issue?
Raw data file in below link
Raw data file and expected output
Solved! Go to Solution.
Hi @hbgv123 ,
Please try the measure.
Measure =
IF (
MAX ( Sheet1[Month] ) <> BLANK (),
CALCULATE (
AVERAGEX (
VALUES ( 'Calendar'[MonthYear] ),
CALCULATE ( AVERAGE ( Sheet1[Risk Score] ) )
),
DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), -2, MONTH ),
ALLSELECTED ( 'Calendar' )
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @hbgv123 ,
Please try the measure.
Measure =
IF (
MAX ( Sheet1[Month] ) <> BLANK (),
CALCULATE (
AVERAGEX (
VALUES ( 'Calendar'[MonthYear] ),
CALCULATE ( AVERAGE ( Sheet1[Risk Score] ) )
),
DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), -2, MONTH ),
ALLSELECTED ( 'Calendar' )
)
)
If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey @hbgv123 ,
Can you try:
RollingAvg = AVERAGEX(DATESINPERIOD(DatesTable[Date],LASTDATE(DatesTable[Date]),-60,DAY),Sum(Table[Risk Score))
Is this you are looking for?
RollingAvg =
VAR NumDays = 2
VAR _1 =
CALCULATE (
AVERAGEX ( VALUES ( Data[Month] ), AVERAGE ( Data[Risk Score] ) ),
DATESINPERIOD ( Data[Month], LASTDATE ( Data[Month] ), -60, DAY )
)
RETURN
_1 / NumDays
Hi,
This is the output i am expecting...
Thanks.. This one is closer to the required value