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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
tobisw
Regular Visitor

Average Calculation

Hello everybody,

 

i´m struggeling with a average calculation in my power bi report. Target what i would like to achieve is, to calculate the 

  • Range of Coverage as average of all parts of a MRP controller in a plant

My Table "PLANTS" structure looks following:

Plant CodePlant MaterialMRP ControllerAttributAmount     
84012402000508600Req./Day34,1     
84012402000508600Actual Range16,6    

 

 

84012402000508600Stock200    

 

7601494600125500Req./Day10     
76014946000125500Actual Range3     
76014946000125500Stock3000     

 

The calculation what i did was following:

1. I created a SUM Measure with following Code:

  SUM Plants =  

  SUM(
  Plants[Amounts])
 
2. Created Measure of Actual Range:
     Actual_range =
     CALCULATE(
     [SUM Plants],
     Plants[Attribut]="Actual range")
 
2. Created Measure of Average Demand per Day :
 
    Average_demand_day =
    CALCULATE(
    [SUM Plants],
    Plants[Attribut]="Req./Day")
 
3. By using Power BI Quickmeasure Creation i wanted to have the Average of "Range of Coverage" of all parts of a MRP Controller in a plant.
 
Average_Actual_range pro MRP Contr. =
AVERAGEX(
    KEEPFILTERS(VALUES('Plants'[MRP Contr.])),
    CALCULATE([Actual_range])
)
 
In my final report, the "Average_Actual_range pro MRP Contr." is sum up everything. My target would be, that the average is not summing up and will show the average result of each single MRP controller.
 
Thanks
Tobias
3 REPLIES 3
amitchandak
Super User
Super User

@tobisw , This formula, will avg above 'Plants'[MRP Contr.] level

 

AVERAGEX(
KEEPFILTERS(VALUES('Plants'[MRP Contr.])),
CALCULATE([Actual_range])
)

 

or

 

AVERAGEX(
VALUES('Plants'[MRP Contr.]),
CALCULATE([Actual_range])
)

 

 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

You mean, that my formula is not correct? Sorry, i´m not sure if i understood your right. By using your formula the result is the same...

Anonymous
Not applicable

Hi @tobisw ,

 

I have a test by your code. And get result as below.

1.png

I think the average of "Acutal_range" in each [MPR Controller] is correct.

For [MPR Controller] = 500, average of "Acutal_range"  = 3/1

For [MPR Controller] = 600, average of "Acutal_range"  = 166/1

Subtotal = (3+166)/2

Could you show a screenshot with the result you want to me?

 

Best Regards,
Rico Zhou

 

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

Helpful resources

Announcements
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.