Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
KVPro
Frequent Visitor

Average from last 3 Months

Hello

I want to calculate average from last 3 months for some products

 

My data looks like:

KVPro_0-1637315617926.png

I have different products A and B with different amount of rows. My last 3M are from 202109 to 202111. For the max value from Year&Month I want to get average from last 3 dates(202109-202111) and I dont want to get average for other dates (0). 

 

How to do it?

 

I have tried to do as this formula, but it shows 202111 for A - 13655, for B - 6862.

AVG 3M =
CALCULATE(
AVERAGEX('Fact','Fact'[Value]),
DATESINPERIOD('Fact'[Date],MAX('Fact'[Date]),-3,MONTH)
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@KVPro , With Date Table and Value Meausre

 

AVG 3M =
CALCULATE(
AVERAGEX(Value('DATE'[Month Year]),[Value]),
DATESINPERIOD('DATE'[Date],MAX('DATE'[Date]),-3,MONTH)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@KVPro , With Date Table and Value Meausre

 

AVG 3M =
CALCULATE(
AVERAGEX(Value('DATE'[Month Year]),[Value]),
DATESINPERIOD('DATE'[Date],MAX('DATE'[Date]),-3,MONTH)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.