Forum Discussion
Static Average per period excluding values
Hello Community,
I need help to create an average measure per period excluding a value in a specific column.
This average needs to remain the same despite slicer applied.
This is my data:
| Date | Agent | Sales |
| 01/02/2023 | A | 2 |
| 01/02/2023 | B | 5 |
| 01/02/2023 | C | 2 |
| 01/02/2023 | D | 3 |
| 02/02/2023 | B | 2 |
| 03/02/2023 | A | 5 |
| 03/02/2023 | B | 2 |
| 03/02/2023 | C | 1 |
| 03/02/2023 | D | 3 |
| 03/02/2023 | E | 4 |
| 04/02/2023 | A | 1 |
| 04/02/2023 | B | 1 |
| 04/02/2023 | C | 3 |
| 04/02/2023 | D | 2 |
| 04/02/2023 | E | 4 |
| 01/03/2023 | A | 1 |
| 01/03/2023 | B | 2 |
| 02/03/2023 | A | 4 |
| 02/03/2023 | B | 2 |
| 02/03/2023 | C | 3 |
| 02/03/2023 | D | 2 |
| 02/03/2023 | E | 3 |
| 03/02/2023 | A | 6 |
| 03/02/2023 | B | 5 |
| 03/02/2023 | C | 6 |
| 03/02/2023 | D | 7 |
| 04/03/2023 | A | 2 |
| 04/03/2023 | B | 1 |
Average for Feb month is 8 (without Agent "E")
Average for Mar month is 8.25 (without Agent "E")
I have tried this approach but it's not working:
Static AVG = CALCULATE(AVERAGE(
'Table'[Sales]), FILTER(ALL('Table'[Date]), CALCULATE(DISTINCTCOUNT('Table'[Agent ]), 'Table'[Agent]<>"E"&&'Table'[Agent]<>"F")))
I will always need to exclude Agent "E" and "F" in the measure. And I will need to apply this measure to a Column and Line Combination Chart and to apply a Slicer to Agent. And when I slice Agent "A", the Static AVG should always remain the same for month Feb = 8 and March = 8.25.
Can you help me?
Thank you.
5 Replies
- johnt75
Super User
Try
Static Average = CALCULATE ( AVERAGE ( 'Table'[Sales] ), ALLEXCEPT ( 'Table', 'Table'[Date] ), NOT 'Table'[Agent] IN { "E", "F" } )- yellow43
Helper I
Thank you johnt75 but it's not the desired output.
The average should be in numerator = sum sales, denominator = distinctcount agent (without E and F).
Line and column graphic:
x-axis = week
y-axis column = by agent
y-axis line = average team (measure above)
Each week I should have a different average by team
Can you help me?
- johnt75
Super User
How about
Static Average = CALCULATE ( DIVIDE ( SUM ( 'Table'[Sales] ), DISTINCTCOUNT ( 'Table'[Agent] ) ), ALLEXCEPT ( 'Table', 'Table'[Date] ), NOT 'Table'[Agent] IN { "E", "F" } )