cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Show the average of top n values in a measure

I am trying to get the average of the top 100 performing students in a cicle of tests to put in a line chart with "Materia" on the shared axis to compare with a specific studant, filtering by "Ciclo" and "PeriodoLetivo",.
I have created a table to calculate the avg performance of every student that had done the specific cicle selected, and in that table i want to create the measure in topic. Here's an example of my table

 CodigoSimulado NumeroPergunta Acertos Simulado TipoSimulado Ciclo PeriodoLetivo IDQuestão Materia Frente Area de Conhecimento 515 13 1 Ciclo 5 2016 Banca Poliedro Simulado FUVEST Ciclo 5 2016 51513 Geografia Geo 2 CH 515 46 0 Ciclo 5 2016 Banca Poliedro Simulado FUVEST Ciclo 5 2016 51546 Matemática Mat 1 MT 515 58 0 Ciclo 5 2016 Banca Poliedro Simulado FUVEST Ciclo 5 2016 51558 Física Fís 1 CN

Thats the formula that i tried to do without any success

```Média Acertos Ciclo TOP 100 =
var media1 = AVERAGEX('MÉDIA CICLO';'MÉDIA CICLO'[Acertos])
return
CALCULATE(TOPN(100;'MÉDIA CICLO';media1;DESC);'MATERIA FRENTE'[Frente])```

3 REPLIES 3
Community Support Team

## Re: Show the average of top n values in a measure

HI @luisvieira95,

You can try to use following measure if it suitable for your requirement:

```measure =
AVERAGEX (
TOPN (
100,
SUMMARIZE (
Table,
[Ciclo],
[PeriodoLetivo],
"Total Acerto", SUM ( 'Table'[Acertos] )
),
[Total Acerto], DESC
),
[Total Acerto]
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |
Frequent Visitor

## Re: Show the average of top n values in a measure

Hi!
Thank you, but it calculates the same exact value of the avg of the whole cicle, and not the Top 100.

Community Support Team

## Re: Show the average of top n values in a measure

Hi @luisvieira95,

You can remove topn function and direct do averagex on summarize table.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 48 members 975 guests
Recent signins: