Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lsutula
New Member

Calcular el promedio del máximo por categoría

Hola, chicos

Estoy luchando para encontrar una solución al desafío que tengo en el trabajo. Tal vez podrías ayudarme.

Tengo una tabla de identificaciones de estudiantes, identificaciones de curso y calificaciones, y necesito calcular el promedio de calificaciones para cada estudiante.

Hay una advertencia: algunos estudiantes repitieron cursos y, por lo tanto, tienen más de una calificación por id de curso. Necesito encontrar la calificación más alta para cada curso, y luego usar solo esas calificaciones para calcular el promedio de un estudiante.

Columnas de la tabla:

LearnerID / ID del curso / Grado

Pude crear una métrica para encontrar el valor máximo de Calificación por ID de curso, pero no puedo encontrar una manera de usar esos valores como entrada para la función promedio.

¡Aprecia cualquier pista!

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hola, @lsutula

Es un placer responder por ti.

De acuerdo con su descripción, creo que puede crear una medida para calcular el resultado deseado.

Así:

Measure 3 =
AVERAGEX (
    SUMMARIZE (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[term] <= SELECTEDVALUE ( 'Table'[term] )
        ),
        'Table'[coursecode],
        "aa", MAX ( 'Table'[grade] )
    ),
    [aa]
)

v-janeyg-msft_0-1604314158026.png

Si no resuelve su problema, por favor no dude en preguntarme.

Saludos

Janey Guo

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

View solution in original post

3 REPLIES 3
v-janeyg-msft
Community Support
Community Support

Hola, @lsutula

Es un placer responder por ti.

De acuerdo con su descripción, creo que puede crear una medida para calcular el resultado deseado.

Así:

Measure 3 =
AVERAGEX (
    SUMMARIZE (
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[term] <= SELECTEDVALUE ( 'Table'[term] )
        ),
        'Table'[coursecode],
        "aa", MAX ( 'Table'[grade] )
    ),
    [aa]
)

v-janeyg-msft_0-1604314158026.png

Si no resuelve su problema, por favor no dude en preguntarme.

Saludos

Janey Guo

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

amitchandak
Super User
Super User

@lsutula , Probar medidas como

AverageX(values(Table[Course ID]), calculate(Max(Table[Grade])))
O
AverageX(Summarize(Table, Table[LearnerID ], Table[Course ID],"_1", calculate(Max(Table[Grade]))),[_1])

Thank you!

Both of your suggestions worked! I have another challenge to solve with that data, maybe you could also help 🙂

 

I need to calculate the cumulative average for each month, which means I need to average all grades until (including) month X.

The challenge though is how to pick only the highest grade for a repeated course.

Let me explain with an example:

example.png

Learner has completed BUS 5010 course in December 2019 with grade 2.00, but then retake the same course in February 2020 and got better grade: 3.00.

Therefore, his cumulative GPA should be the following:

December 2019: 2.00 (only one course, and only one grade, simple)

February 2020: 3.00 (here's the challenge - the leaner took the same course and got a better grade, so we should drop the lower grade and use only the higher, 3.00)

March 2020: 3.50 ((3.00+4.00) / 2 = 3.50)

April 2020: 3.33 ((3.00+4.00+3.00) / 3 = 3.33)

May 2020: 3.25 ((3.00+4.00+3.00+3.00) / 4 = 3.25)

 

You'll notice the learner took course OPM6090 twice. Once in July 2020 (scored 3.00) and then in September 2020 (scored 4.00). We should use score 3.00 until August in the cumulative average calculation, but as of September use the higher grade: 4.00 instead of 3.00.

 

Uff, hope this makes sense. Would be amazing if you have an idea of how to calculate such a cumulative average.

Thanks!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.