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
ANM_97
Helper IV
Helper IV

EXPOSICION TOP N

Hola

Tengo esta situación:

CustomeridClienteGroupidCUSTOMER_GROUPExposición
001A1001100
002B2002100
003C3003800
004D1001200
005E1001500
006F2002350
007G200250

Necesito obtener el valor para los 2 mejores grupos.

Yo uso esta masure:

Top2_exposure por grupos de grupos de cálculo([EXPOSURE],
TOPN(2,CLIENTES,CLIENTES[CUSTOMER_GROUP],DESC))

Pero la medida devuelve la exposición en los 2 principales clientes, no en el grupo. ¿Cómo puedo elegir la columna que se va a filtrar?

Resultado esperado: Top2_exposure por grupos 1 600$ no 1300$

CUSTOMER_GROUPExposición
1800
2500
3800

¡Muchas gracias!

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

hola @ANM_97

Simplemente ajuste la fórmula como se muestra a continuación:

Top2_exposure by groups = CALCULATE(SUM(CUSTOMERS[EXPOSURE]),
                                                        TOPN(2,VALUES(CUSTOMERS[CUSTOMER_GROUP]),CALCULATE(SUM(CUSTOMERS[EXPOSURE])),DESC))

Resultado:

1.JPG

o probar esta lógica de la fórmula

Top2_exposure by groups 2 = 
var _table=TOPN(2,ALLSELECTED(CUSTOMERS[CUSTOMER_GROUP]),CALCULATE(SUM(CUSTOMERS[EXPOSURE])),DESC) return
CALCULATE(SUM(CUSTOMERS[EXPOSURE]),  FILTER(CUSTOMERS,  CUSTOMERS[CUSTOMER_GROUP] in _table))

Resultado:

2.JPG

saludos

Lin

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

View solution in original post

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

hola @ANM_97

Simplemente ajuste la fórmula como se muestra a continuación:

Top2_exposure by groups = CALCULATE(SUM(CUSTOMERS[EXPOSURE]),
                                                        TOPN(2,VALUES(CUSTOMERS[CUSTOMER_GROUP]),CALCULATE(SUM(CUSTOMERS[EXPOSURE])),DESC))

Resultado:

1.JPG

o probar esta lógica de la fórmula

Top2_exposure by groups 2 = 
var _table=TOPN(2,ALLSELECTED(CUSTOMERS[CUSTOMER_GROUP]),CALCULATE(SUM(CUSTOMERS[EXPOSURE])),DESC) return
CALCULATE(SUM(CUSTOMERS[EXPOSURE]),  FILTER(CUSTOMERS,  CUSTOMERS[CUSTOMER_GROUP] in _table))

Resultado:

2.JPG

saludos

Lin

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

@v-lili6-msft ¡Funciona!

¿Cómo introduzco la condición "no NULL" para CUSTOMER_GROUPS?

Tengo esta situación en mi proyecto:

CustomeridClienteGroupidCUSTOMER_GROUPExposición
2000
1A1001100
2B2002100
3C3003800
4D1001200
5E1001500
6F2002350
7G200250

Esto hace que el resultado 2800$.

¡¡Gracias!!

@v-lili6-msft ¡Estoy resuelto, gracias!

parry2k
Super User
Super User

@ANM_97 este es el resultado correcto, ¿correcto?

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k No, el resultado correcto es: 1600.

Resultado esperado: Top2_exposure por grupos 1 600$ no 1300$

CUSTOMER_GROUPExposición
1800
3800
2500

SUM(Top2_exposure por grupos) a 1600

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.