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

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

Reply
JWick1969
Helper IV
Helper IV

Previous 3Mos average Forecasted

Hi All,

 

I'm trying to create a measure to get Previous 3Mos average, yet could not figure out on how to do this in DAX. I need to get the previous 3 months average of completed pct infront of the current month dynamically.  Thank you.

 

Sample : previous 3 month average

 

1/1/2019 shows no average result

2/1/2019 shows no average result

3/1/2019 shows no average result

4/1/2019 shows average of completd pct of (Jan-Feb-Mar)

5/1/2019 shows average of completd pct of (Feb-Mar-Apr)

and so on

 

Sample Data and expected result:

SampleData.jpg

Thank you. in Advance.

4 REPLIES 4
JWick1969
Helper IV
Helper IV

Is there anyone has an idea to do this in DAX? Thank you.

az38
Community Champion
Community Champion

Hi @JWick1969 

try a measure

 

Measure = 
var _AVGpct = CALCULATE(AVERAGE(Query[Completed pct]);FILTER(ALL(Query);datediff(Query[Month];SELECTEDVALUE(Query[Month]);MONTH)<=3 && Query[Month]< SELECTEDVALUE(Query[Month])))
var _AVGcount = CALCULATE(COUNTROWS(Query);FILTER(ALL(Query);datediff(Query[Month];SELECTEDVALUE(Query[Month]);MONTH)<=3 && Query[Month]< SELECTEDVALUE(Query[Month])))
RETURN
IF(_AVGcount>=3;_AVGpct;BLANK())

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thanks for the reply.  I got an error which i think the semicolon. what is the use of semicolon? is this a parameter separator? by the way, my PBI version (April2019)

az38
Community Champion
Community Champion

Hi @JWick1969 

it's a system localization question.

replace all ";" in my statement to ","

 

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.