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
Syndicate_Admin
Administrator
Administrator

Cómo clasificar los valores en función del número de filas que contienen estos valores

Hola a todos,

Tengo un problema al usar la función de rango, pero creo que el problema es mi cerebro 😁

Tengo una tabla que contiene datos sobre alertas de servidores: en los detalles de estas alertas tengo el nombre de los equipos que enviaron la alerta.

# Ejemplo dado:

alerta 1 = > del equipo 1

alerta 2 = > del equipo 1

alerta 3 = > del equipo 2

alerta 4 = > del equipo 2

alerta 5 = > del equipo 2

alerta 6 = > del equipo 3

Me gustaría obtener el rango por equipo en función del número de alertas enviadas:

equipo 1 = > 2º

equipo 2 = > 1º
equipo 3 = > 3º

¿Cómo puedo hacerlo?

¡Gracias por su tiempo!

2 ACCEPTED SOLUTIONS
Syndicate_Admin
Administrator
Administrator

Hola, @Bruno_M
Solución dinámica como columna calculada:

Ranking = 
var CurrentTeam = Ranking[Team]
var CountOfAlertsPerTeam = SUMMARIZE(Ranking, Ranking[Team], "AlertsCount", COUNTA(Ranking[Alerts]))
var AddRank = ADDCOLUMNS(CountOfAlertsPerTeam, "RankingTeams", RANKX(CountOfAlertsPerTeam, [AlertsCount], ,DESC, Dense), "Team_ForRanking", Ranking[Team])
var CurrentTeamFromRank = MAXX(FILTER(AddRank, CurrentTeam IN  {[Team_ForRanking]}), [RankingTeams])

return CurrentTeamFromRank

vojtechsima_0-1650634041446.png

Mi tabla de pruebas:
AlertsTeam

Alerta 1 Equipo 1
Alerta 2 Equipo 1
Alerta 3 Equipo 4
Alerta 4 Equipo 3
Alerta 5 Equipo 6
Alerta 6 Equipo 2
Alerta 7 Equipo 2
Alerta 8 Equipo 2
Alerta 9 Equipo 3
Alerta 10 Equipo 1
Alerta 11 Equipo 3
Alerta 12 Equipo 3
Alerta 13 Equipo 3
Alerta 14 Equipo 2

View solution in original post

Hola, funciona bien gracias 😊

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

Hola, @Bruno_M
Solución dinámica como columna calculada:

Ranking = 
var CurrentTeam = Ranking[Team]
var CountOfAlertsPerTeam = SUMMARIZE(Ranking, Ranking[Team], "AlertsCount", COUNTA(Ranking[Alerts]))
var AddRank = ADDCOLUMNS(CountOfAlertsPerTeam, "RankingTeams", RANKX(CountOfAlertsPerTeam, [AlertsCount], ,DESC, Dense), "Team_ForRanking", Ranking[Team])
var CurrentTeamFromRank = MAXX(FILTER(AddRank, CurrentTeam IN  {[Team_ForRanking]}), [RankingTeams])

return CurrentTeamFromRank

vojtechsima_0-1650634041446.png

Mi tabla de pruebas:
AlertsTeam

Alerta 1 Equipo 1
Alerta 2 Equipo 1
Alerta 3 Equipo 4
Alerta 4 Equipo 3
Alerta 5 Equipo 6
Alerta 6 Equipo 2
Alerta 7 Equipo 2
Alerta 8 Equipo 2
Alerta 9 Equipo 3
Alerta 10 Equipo 1
Alerta 11 Equipo 3
Alerta 12 Equipo 3
Alerta 13 Equipo 3
Alerta 14 Equipo 2

Hola, funciona bien gracias 😊

Syndicate_Admin
Administrator
Administrator

Hola @Bruno_M ,

Primero creé un equipo de tabla con solo una columna para tener cada equipo representado (seleccione crear una tabla):

equipo = SELECCIONARCOLUMNAS(distinto(Hoja4[equipo]),"equipo",(Hoja4[equipo]))

Luego cuento el nbr de alerta para cada uno:
nbr_alert = Calcular(CONTAR(Hoja4[alerta]),
FILTRO(TODO(Hoja4),
equipo[equipo] = Hoja4[equipo]))

Finally I ranked them :
rango = RANKX(equipo,equipo[nbr_alert])

Saludos

PD: Utilicé una tabla como esta para la prueba philouduv_0-1650633229992.png

Hi philouduv

VISTA PREVIA
Gracias por la rápida respuesta 👍
No tuve éxito de la manera: la tabla del equipo no se reconocía en la condición de filtro.
Puede ser enlace a mi modelo de datos.. Intentaré depurar más adelante
Lo hice con una columna calculada (más familiarizada) como sugiere vojtechsima.

Saludos

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.