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
DavidData
Frequent Visitor

¡Tener problemas con los percentiles!

Hola a todos, estoy teniendo un poco de problemas haciendo que una idea funcione, quiero una columna que clasifique una lista de "agentes" en diferentes cuartiles (Q1,Q2,Q3,Q4), he leído todo alrededor del foro, pero no puedo conseguir que funcione.

Mis fuentes de datos son:
A) "DatosAgentes" con toda la información personal de los agentes

B) "bruto_llamadas", que se conecta a MySQL, dentro de B hay una lista de llamadas, con el AHT (Tiempo medio de manejo) y el identificador del agente o "Inicio de sesión",

Datos de ejemplo:

Un:

Iniciar sesiónAgente
76000David
76001Carlos
76002Mario
76003ARANTXA
76004Maria
76005

MACARENA

B)

UCID (IDENTIFICADOR ÚNICO)AgenteAhtFecha
LLAME AL NÚMERO 17600148504/11/2020
LLAME AL NÚMERO 27600723218/10/2020
LLAME AL NÚMERO 37600333931/08/2020
LLAME AL NÚMERO 47600014327/10/2020
LLAME AL NÚMERO 57600348028/08/2020
LLAME AL NÚMERO 67600223411/09/2020
LLAME AL NÚMERO 77600024806/11/2020
LLAME AL NÚMERO 87600537910/09/2020
LLAME AL NÚMERO 97600241217/10/2020
LLAME AL NÚMERO 107600031417/09/2020
LLAME AL NÚMERO 117600745214/09/2020
LLAME AL NÚMERO 127600624228/08/2020
LLAME AL NÚMERO 137600548116/08/2020
LLAME AL NÚMERO 147600230108/09/2020
LLAME AL NÚMERO 157600737413/08/2020
LLAME AL NÚMERO 167600319008/08/2020
LLAME AL NÚMERO 177600122606/10/2020
LLAME AL NÚMERO 187600114519/10/2020
LLAME AL NÚMERO 197600720322/08/2020
LLAME AL NÚMERO 207600320104/11/2020
LLAME AL NÚMERO 217600030106/09/2020
LLAME AL NÚMERO 227600718304/09/2020
LLAME AL NÚMERO 237600116707/10/2020
LLAME AL NÚMERO 247600043907/09/2020

Dentro (A) calculo el promedio de AHT(y aún más KPI) con esta fórmula "CALCULATE(AVERAGE(bruto_llamadas[TMO-1]),ALL(bruto_llamadas[TMO-1]))" dentro de TMO-1 son sólo las duranciones de llamada del mes actual.

Mi resultado deseado es así:

AgenteAHT(AVG)Q
David2891
Carlos2561
Mario3163
ARANTXA3032
Maria0-
MACARENA4304

Quiero clasificar a los agentes en 4 Q diferentes dependiendo de su TMO-1 promedio.

¿Me puedes ayudar?

Gracias.

1 ACCEPTED SOLUTION

Estás buscando esto???

littlemojopuppy_0-1605558537533.png
Puede descargar el archivo de Excel... las medidas están en Power PivotPower Pivot .

Edición de la aceptación de postes para incluir las medidas:

Agent Average Handling Time:=AVERAGEX(
	Agents,
	[Average Handling Time]
)


Agent 1st Quartile:=PERCENTILEX.INC(
	ALL(Agents),
	[Agent Average Handling Time],
	.25
)


Agent Quartile Bucket:=SWITCH(
		TRUE(),
		[Agent Average Handling Time] <= [Agent 1st Quartile], "1st",
		AND(
			[Agent Average Handling Time] > [Agent 1st Quartile],
			[Agent Average Handling Time] <= [Agent 2nd Quartile]
		), "2nd",
		AND(
			[Agent Average Handling Time] > [Agent 2nd Quartile],
			[Agent Average Handling Time] <= [Agent 3rd Quartile]
		), "3rd",
		AND(
			[Agent Average Handling Time] > [Agent 3rd Quartile],
			[Agent Average Handling Time] <= [Agent 4th Quartile]
		), "4th",
		BLANK()
	)

View solution in original post

10 REPLIES 10
littlemojopuppy
Community Champion
Community Champion

@DavidData descargar el archivo de nuevo desde el enlace anterior y echar un vistazo 🙂

littlemojopuppy
Community Champion
Community Champion

Esa fue mi mala... poner la mesa dentro de la función ALL().

Así que para llegar a la salida deseada vas a necesitar otra medida que mire el AHT de un agente y lo compare con los valores del cuartil y luego asigne Q1, Q2, etc. Hemos detectado un problema desconocido.

SWITCH()
	TRUE(),
	[Agent AHT] < [1st Quartile], "Q1",
	AND
		[Agent AHT] >= [1st Quartile],
		[Agent AHT] < [2nd Quartile
	), "Q2",
	AND
		[Agent AHT] >= [2nd Quartile],
		[Agent AHT] < [3rd Quartile
	), "Q3",
	AND
		[Agent AHT] >= [3rd Quartile],
		[Agent AHT] < [4th Quartile
	), "Q4",
	BLANK()
)

Lo siento, tal vez me lo he explicado mal. Sé que tendré que comparar el aht de cada agente con la diferente Q dentro de la tabla, pero el problema es que cuando calculo los cuartiles el cálculo se hace dentro de cada agente.

Estás buscando esto???

littlemojopuppy_0-1605558537533.png
Puede descargar el archivo de Excel... las medidas están en Power PivotPower Pivot .

Edición de la aceptación de postes para incluir las medidas:

Agent Average Handling Time:=AVERAGEX(
	Agents,
	[Average Handling Time]
)


Agent 1st Quartile:=PERCENTILEX.INC(
	ALL(Agents),
	[Agent Average Handling Time],
	.25
)


Agent Quartile Bucket:=SWITCH(
		TRUE(),
		[Agent Average Handling Time] <= [Agent 1st Quartile], "1st",
		AND(
			[Agent Average Handling Time] > [Agent 1st Quartile],
			[Agent Average Handling Time] <= [Agent 2nd Quartile]
		), "2nd",
		AND(
			[Agent Average Handling Time] > [Agent 2nd Quartile],
			[Agent Average Handling Time] <= [Agent 3rd Quartile]
		), "3rd",
		AND(
			[Agent Average Handling Time] > [Agent 3rd Quartile],
			[Agent Average Handling Time] <= [Agent 4th Quartile]
		), "4th",
		BLANK()
	)

EDITAR: Lo sentimos, no comproba el archivo, estoy comprobando cómo lo has hecho funcionar en Excel, ni siquiera sabías que podías hacer ese tipo de fórmula dentro de Excel. Gracias

Okey... así que.. su trabajo en parte, mantiene el mismo valor entre los agentes, por lo que es un plus, pero ahora una cosa que no especificé al principio, sí aplico filtros a los datos, como de qué servicio viene la llamada y necesito la Q para respetar los filtros,

Por lo que he visto hasta ahora calcula los cuartiles de todas las llamadas, no sólo las que he seleccionado en el filtro. ¿Cómo puedo hacer que funcione así?

¡Hola! No vi esta respuesta hasta ahora. Pide disculpas por el retraso 😔

Los cálculos de percentiles utilizan la función ALL en ellos. Cambie ALL a ALLEXCEPT e incluya los campos por los que desea filtrar. Por ejemplo ALLEXCEPT('Handing Times', [Date])

Sorry to bother you again, now it IS calculating with the correct data(thanks for the tip with allexcept, its working!) but I dont know why the number of agents per Q is not the same, when doing percentiles, well, quartiles, all 4 of them have to be the same size. 

 

If you need me to send you the file or to screenshot all the formulas.. i dont mind if the file is kept private.

Current result:

DavidData_0-1605691573990.png

Desired result:

DavidData_0-1605691993646.png

 

 

Have to say even if its not working right now as I wanted, thanks for all your help @littlemojopuppy and patience, I come from an only excel enviroment and I've been trying with curses to make PowerBI work for me...

De acuerdo... los cálculos estaban dividiendo las llamadas en cubos de percentil basados en el tiempo, no en los agentes... permítanme modificar los cálculos. Le avisará cuando pueda descargar el archivo de nuevo.

littlemojopuppy
Community Champion
Community Champion

A menos que me esté perdiendo algo, ¿no funcionaría esto?

PERCENTILEX.EXC(
Agents,
[Average AHC],
-- First Quartile, modify as appropriate for others
.25
)

https://docs.microsoft.com/en-us/dax/percentilex-exc-function-dax

Eso es lo que me sin embargo, pero cuando entro en esa fórmula muestra el primer cuartil para cada agente. (Cuartil - Q)

Captura.JPG

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.