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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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)
)

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)
)

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.