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
Anonymous
Not applicable

Average value for entire table with filters

Hi Everyone, 

 

Looking for some advice please. I am trying to create a column in my "opportunites" table that gives me the average of the entire table but with some filters.

I want it to Average the total value of opportunity rows that are of product type "Toolkit", are forecasted at "pipeline" and where the oportunity value is greater than 0. I am then planning on repeating this column for each of our other products. The end goal will then be to create a last column for each product that compares if the value of that opportunity is greater than the average and then finally show a dashboard that shows opportunities that are greater than the average for that product type.

 

Using the product Toolkit as an example the formula i have right now but is not filtering correctly is;

 

Average Toolkit = CALCULATE(SUMX(ALL(Opportunities),Opportunities[Value]),Opportunities[Type]="Toolkit",Opportunities[Forecast]="Pipeline",Opportunities[value]>0)
/CALCULATE(COUNTX(ALL(Opportunities),Opportunities[Value]),Opportunities[Type]="Toolkit",Opportunities[Forecast]="Pipeline",Opportunities[value]>0)
 
Thank you in advance 🙂 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you for the above @Anonymous The solution got me 98% of the way there by suggesting the use of "FILTER". In the end the formula that worked was;

 

CALCULATE(SUM(Opportunities[Value]),

FILTER(Opportunities,Opportunities[Type]="Toolkit"),

FILTER(Opportunities,Opportunities[Value]>0),

FILTER(Opportunities,Opportunities[Forecast]="Pipeline"))

/

CALCULATE(COUNTROWS(Opportunities),

FILTER(Opportunities,Opportunities[Value]>0),

FILTER(Opportunities,Opportunities[Forecast]="Pipeline"),

FILTER(Opportunities,Opportunities[Type]="Toolkit"))

 

Thanks again for the help!

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank you for the above @Anonymous The solution got me 98% of the way there by suggesting the use of "FILTER". In the end the formula that worked was;

 

CALCULATE(SUM(Opportunities[Value]),

FILTER(Opportunities,Opportunities[Type]="Toolkit"),

FILTER(Opportunities,Opportunities[Value]>0),

FILTER(Opportunities,Opportunities[Forecast]="Pipeline"))

/

CALCULATE(COUNTROWS(Opportunities),

FILTER(Opportunities,Opportunities[Value]>0),

FILTER(Opportunities,Opportunities[Forecast]="Pipeline"),

FILTER(Opportunities,Opportunities[Type]="Toolkit"))

 

Thanks again for the help!

 
Anonymous
Not applicable

Thanks at @amitchandak I am doing a column and i want the output to be the same value for every single row in the table so that i can compare to see if the value of the opportunty is greater than the average. The above gives me a different value for each row. I could do a measure but dont think that would work? 🤔


So ideally id like the average toolkit to column in this example to be 37969 all the way down.

VikkiC_0-1604675833461.png

 

 

Anonymous
Not applicable

@Anonymous 

I don't think you should use sumx and countx with all(table) if you create a columns. Try this:

 

CALCULATE(SUM(Opportunities[Value]),Filter('Opportunities',Opportunities[Type]="Toolkit",Opportunities[Forecast]="Pipeline",Opportunities[value]>0))
/
CALCULATE(COUNTROWS(Opportunities),Filter('Opportunities',Opportunities[Type]="Toolkit",Opportunities[Forecast]="Pipeline",Opportunities[value]>0))
 

Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Anonymous , is this a column or measure. If measure you can not use it in the column.

If it is column then try like

Average Toolkit = CALCULATE(SUMX((Opportunities),Opportunities[Value]),Opportunities[Type]="Toolkit",Opportunities[Forecast]="Pipeline",Opportunities[value]>0)
/CALCULATE(COUNTX((Opportunities),Opportunities[Value]),Opportunities[Type]="Toolkit",Opportunities[Forecast]="Pipeline",Opportunities[value]>0)

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!

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.

Top Solution Authors
Top Kudoed Authors