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
tomasbaleriani
Frequent Visitor

Calculate Average with Filter Context

Hi, i have a problem that i can´t solve.

 

tomasbaleriani_0-1663592545601.png

I have the results of machine learning's models, divided by month and decil.

 

What i am trying to do is to calculate the average conversion rate(Sales/Calls) when I apply filter context.

 

tomasbaleriani_1-1663592720764.png

These are the results for the two models in July, being:

% CONVERSION URU =  CALCULATE(DIVIDE([Sales URU],[Calls URU]),ALLSELECTED(Uruguay[modelo]))

% AVG URU = CALCULATE(AVERAGEX(Uruguay,[% CONVERSION URU]),ALLSELECTED(Uruguay[modelo]),ALL(Uruguay[decil]))
 
The thing is that when I apply filter context and select the two models together, this i what i get:
tomasbaleriani_2-1663592914236.png

What "% AVG URU" is doing is (0,31+0,42)/2 = 0,36 but what i expect to do is:

 

(0,95+0,71+0,63+0,34+0,2+...+0,04)/10  = 0,32

 

Thank you so much!

 

 

 

5 REPLIES 5
tomasbaleriani
Frequent Visitor

Model 1

DECILCALLSSALES

SALES/CALLS

10

784965280.67%
9764283060.4%
8   
7   
6.........
5.........
4   
3   
2.........
1.........

 

Model 2

DECILCALLSSALESSALES / CALLS
10168071210.72%
916500910.55%
816233850.52%
7.........
6.........
5.........
4.........
3.........
2...  
1   

 

I have created a data segmentation that filter Model 1 and Model 2 and these are the result

 

DECILCALLSSALESSALES / CALLS
1095303 (78496+16807)649 (528+121)0.68%
9929283990.43%
8.........
7.........
6.........
5   
4   
3   
2   
1.........

 

I have created the next measure:

[AVG SALES/CALLS] = 

    CALCULATE(
    AVERAGEX(TABLE,DIVIDE(SALES.CALLS))
 
What i get is the average of the two models... ((0.67%+0.4%+...)/10+(0.72%+0.55%...)/10))/2
 
But i want to get is the average of the last table
(0.68%+0.43%+....)/10
 
Thank you so much!
 
 
 

[AVG SALES/CALLS] = DIVIDE(SUMX(TABLE,SALES),SUMX(TABLE,CALLS),0)

Thank you for your response. However, I´m not getting the desired result.

With your measure, what i get is this

DECILCALLSSALESSALES/CALLS

10

95303(78496+16807)649(528+121)0.68%
9929283990.43%
8899163600.4%
7857532330.27%
6793701990.25%
5714241880.26%
417771680.38%
320885690.33%
222536650.29%
124100510.21%

 

[AVG SALES/CALLS] = (649+399+...)/(95303+...24100) = 0.38%

What i want to get...

 

[AVG SALES/CALLS] = (0.68%+0.43%+0.4%+...+0.21%)/10 = 0.35%

 

Thank you!

 

 

[AVG SALES/CALLS] = AVERAGEX(DIVIDE(SUM(TABLE[SALES]),SUM(TABLE[CALLS]),0)

lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.