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

Suma contra grupo de recuento

Hola

Tengo una tabla de hechos de datos de ventas donde tengo customerKey , saleAmount y date en cada registro.

customerKey puede repetirse para las transacciones de venta en un período.

Ahora quiero calcular la suma de ventaAmount contra el recuento de clientes divididos en grupos.

por ejemplo,

Recuento de Cliente1 en la tabla de venta n.o 3

Recuento de Cliente2 en la tabla de venta 5

Recuento de Clientes3 en la tabla de venta 8

Recuento de Clientes4 en la mesa de venta 4

Recuento de Cliente5 en la tabla de venta 2

los grupos de recuento son 1-5, 6-10, 11-15

Necesito una suma total de venta que se calcula sobre el recuento de clientes que caen en grupos superiores.

He probado varias soluciones, pero la suma de los grupos de recuento no se puede lograr. La ayuda será muy apreciada.

Gracias

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

No @binerdy ,

Intente crear dos columnas como se muestra a continuación:

count_customer = CALCULATE(COUNT('Table'[date]),ALLEXCEPT('Table','Table'[customerKey]))
groups = SWITCH(TRUE(),
            'Table'[count_customer]>=1&&'Table'[count_customer]<=5,"1-5",
            'Table'[count_customer]>=6&&'Table'[count_customer]<=10,"6-10",
            ">10")

V-lianl-msft_0-1610348659847.png

Ejemplo .pbix

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

View solution in original post

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

No @binerdy ,

Intente crear dos columnas como se muestra a continuación:

count_customer = CALCULATE(COUNT('Table'[date]),ALLEXCEPT('Table','Table'[customerKey]))
groups = SWITCH(TRUE(),
            'Table'[count_customer]>=1&&'Table'[count_customer]<=5,"1-5",
            'Table'[count_customer]>=6&&'Table'[count_customer]<=10,"6-10",
            ">10")

V-lianl-msft_0-1610348659847.png

Ejemplo .pbix

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

parry2k
Super User
Super User

@binerdy funcionará, pero no estoy seguro de por qué está recibiendo este error. ¿Puede cambiar Countrows a COUNT ( FactTable[CustomerKey] )



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
Super User
Super User

@binerdy agregar una nueva columna en la tabla de clientes, es similar al análisis ABC

Count in Sales Table = 
CALCULATE ( COUNTROWS ( SalesTable ), ALLEXCEPT ( Customer, Customer[CustomerKey] ) )

Ahora, en un objeto visual de tabla, use esta nueva columna (no; res resuma ya que es un número) y coloque el importe de venta de la tabla de ventas, y obtendrá el resultado.

Consulta mi última entrada de blog Año-2020, Pandemia, Power BI y más allá para obtener un resumen de mis versiones favoritas de las características de Power BI en 2020

Me gustaría elogios si mi solución ayudara. 👉 Si puedes dedicar tiempo a publicar la pregunta, también puedes hacer esfuerzos para dar Felicitaciones a quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!

Visítenos en https://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.



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 Gracias por su respuesta.

Estoy recibiendo este error

binerdy_0-1609952046675.png

y si se corrige esta medida, ¿cómo vamos a calcular la suma de saleAmount contra la agrupación de recuentos de clientes.

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.