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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Calculated average of the last three months

Hi Power BI Community! 

DoA Rate 3 month.PNGCount of parts last three monthsCount of parts last three months

This measure: DOA rate (monthly) = var result =(DIVIDE('Parts per Month'[DoAs]; [Count of Parts]))+0
return if(result; result; IF(MAX(Dates[Date2])>DATE(2019;9;30);0; BLANK())) gives me the right per cent per month.
For example August= (1 DoA / 72 parts) * 100 = 1,39 % 

Now I have problems to calculated the average of the three month in per cent. 
For example last three months total 13,13 % / 3 months = 4,37 % 
How is this possible? 
I have a measure that calculats (all DoAs of the last three months (22 DoAs) / all Parts of the last month (421 parts))*100 
= 5,22 % 
Why is there a 0,85 % differenz?
 
Thank you for your time
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

 

I think this may be a mathematical problem.

 

(A1/A2+B1/B2+C1/C2)/3≠(A1+B1+C1)/(A2+B2+C2)

 

If I haven't explained clearly, substitute the formula into the number.

 

(1/2+1/4+1/4)/3=0.33 ≠ (1+1+1)/(2+4+4)=0.3

 

 

 

Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous 

 

I think this may be a mathematical problem.

 

(A1/A2+B1/B2+C1/C2)/3≠(A1+B1+C1)/(A2+B2+C2)

 

If I haven't explained clearly, substitute the formula into the number.

 

(1/2+1/4+1/4)/3=0.33 ≠ (1+1+1)/(2+4+4)=0.3

 

 

 

Best Regards,
Stephen Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , try like with a date table

 

Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,MONTH))/3
Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-3,MONTH))/3

 

Rolling 3 till last month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],-1,month)),-3,MONTH))/3

 

Rolling 3 = CALCULATE(Average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,MONTH))/3
Rolling 3 = CALCULATE(Average(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-3,MONTH))/3

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

 

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.