Forum Discussion
tomasbaleriani
3 years agoFrequent Visitor
Calculate Average with Filter Context
Hi, i have a problem that i can´t solve. 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(...
tomasbaleriani
3 years agoFrequent Visitor
Model 1
| DECIL | CALLS | SALES | SALES/CALLS |
10 | 78496 | 528 | 0.67% |
| 9 | 76428 | 306 | 0.4% |
| 8 | |||
| 7 | |||
| 6 | ... | ... | ... |
| 5 | ... | ... | ... |
| 4 | |||
| 3 | |||
| 2 | ... | ... | ... |
| 1 | ... | ... | ... |
Model 2
| DECIL | CALLS | SALES | SALES / CALLS |
| 10 | 16807 | 121 | 0.72% |
| 9 | 16500 | 91 | 0.55% |
| 8 | 16233 | 85 | 0.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
| DECIL | CALLS | SALES | SALES / CALLS |
| 10 | 95303 (78496+16807) | 649 (528+121) | 0.68% |
| 9 | 92928 | 399 | 0.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!
lbendlin
Super User
3 years ago[AVG SALES/CALLS] = DIVIDE(SUMX(TABLE,SALES),SUMX(TABLE,CALLS),0)
- tomasbaleriani3 years agoFrequent Visitor
Thank you for your response. However, I´m not getting the desired result.
With your measure, what i get is this
DECIL CALLS SALES SALES/CALLS 10
95303(78496+16807) 649(528+121) 0.68% 9 92928 399 0.43% 8 89916 360 0.4% 7 85753 233 0.27% 6 79370 199 0.25% 5 71424 188 0.26% 4 17771 68 0.38% 3 20885 69 0.33% 2 22536 65 0.29% 1 24100 51 0.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!
- lbendlin3 years ago
Super User
[AVG SALES/CALLS] = AVERAGEX(DIVIDE(SUM(TABLE[SALES]),SUM(TABLE[CALLS]),0)