Reply
ngct1112
Post Patron
Post Patron
Syndicated - Inbound

Cómo contar el recuento distinto de una columna

Source Community: Power BI

Hola a todos, me gustaría contar cuántas veces el valor distintivo de "Producto">1. ¿Alguien podría aconsejar cómo agregar esta medida? En este caso, Producto A, B, C, estos 3 productos se producen más de 1, por lo que la anwer debe ser 3

IdProducto
1A
2B
3C
4A
5A
6B
7D
8E
9F
10C
3 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Source Community: Power BI
Syndicated - Inbound

Quizás:

Measure =
  VAR __Table = 
    SUMMARIZE(
      'Table',
      [Product],
      "__Count",COUNTROWS('Table')
    )
RETURN
  COUNTROWS(FILTER(__Table,[__Count]>1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Source Community: Power BI
Syndicated - Inbound

Hola

Escribir estas medidas

Total price = SUM(Data[Net Price])
Measure = SUMX(FILTER(SUMMARIZE(VALUES(Data[Product]),Data[Product],"ABCD",COUNTROWS(Data),"EFGH",[Total price]),[ABCD]>1),[EFGH])

Arrastre la segunda medida al objeto visual. El resultado será 130.

Espero que esto ayude.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Source Community: Power BI
Syndicated - Inbound

Hola

Escriba esta medida

Medidas: SUMX(FILTER(SUMMARIZE(VALUES('Table1'[Product]),'Table1'[Product],"ABCD",CALCULATE(COUNTROWS('Table1'),Table1[Net Price]>0),"EFGH",[Total price]),[ABCD]>1&&[EFGH]<>BLANK()),[EFGH]))))))))))))))))))).)).)))))))))))))))))))))))))))))))))))))))))))))))/[ABCD]>1&&[EFGH]<>BLANK()),[EFGH]))))))))))))))))))________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Espero que esto ayude.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

12 REPLIES 12
Greg_Deckler
Super User
Super User

Source Community: Power BI
Syndicated - Inbound

Quizás:

Measure =
  VAR __Table = 
    SUMMARIZE(
      'Table',
      [Product],
      "__Count",COUNTROWS('Table')
    )
RETURN
  COUNTROWS(FILTER(__Table,[__Count]>1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Source Community: Power BI
Syndicated - Inbound

se ve perfecto. ¡Gracias por tu ayuda!

Source Community: Power BI
Syndicated - Inbound

¿Puedo preguntar además que hay alguna manera de calcular el "Precio" por el filtro anterior (contar producto >1)?

A+B+C-10+20+30+10+10+20+30

Se apreciará si hay alguna solución.

IdProductoPrecio neto
1A10
2B20
3C30
4A10
5A10
6B20
7D40
8E50
9F60
10C30

Source Community: Power BI
Syndicated - Inbound

Hola

Escribir estas medidas

Total price = SUM(Data[Net Price])
Measure = SUMX(FILTER(SUMMARIZE(VALUES(Data[Product]),Data[Product],"ABCD",COUNTROWS(Data),"EFGH",[Total price]),[ABCD]>1),[EFGH])

Arrastre la segunda medida al objeto visual. El resultado será 130.

Espero que esto ayude.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Source Community: Power BI
Syndicated - Inbound

@Ashish_Mathur Esto está funcionando perfectamente. Realmente apreciado!

Source Community: Power BI
Syndicated - Inbound

@Ashish_Mathur , si es posible, me gustaría hacer un poco más basado en su fórmula proporcionada.

Para el mismo método de cálculo, ¿es posible que pueda contar "Procduct >1" sólo si "Precio neto" no está vacío?

Si este caso, el recuento de "C" es 1

sólo A & B es >1 y el precio de suma será 70.

Intento algo como pero no funciona.

Medidas: SUMX(FILTER(SUMMARIZE(VALUES('Table1'[Product]),'Table1'[Product],"ABCD",COUNTROWS('Table1'),"EFGH",[Precio total]),[ABCD]>1),[EFGH]<>BLANK())
IdProductoPrecio neto
1A10
2B20
3C
4A10
5A10
6B20
7D
8E50
9F60
10C30

Source Community: Power BI
Syndicated - Inbound

Hola

Pruebe esta medida

Medidas: SUMX(FILTER(SUMMARIZE(VALUES('Table1'[Product]),'Table1'[Product],"ABCD",COUNTROWS('Table1'),"EFGH",[Precio total]),[ABCD]>1&&[EFGH]<>BLANK()),[EFGH])

Espero que esto ayude.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Source Community: Power BI
Syndicated - Inbound

@Ashish_Mathur He probado las dos de estas dos medidas, todavía no puede obtener la respuesta de 70. Todavía cuentan el valor de C.

Se aprecia si pudiera sugerir

Medidas1 - SUMX(FILTER(SUMMARIZE(VALUES('Table1'[Product]),'Table1'[Product],"ABCD",
COUNTROWS('Table1'),"EFGH",[Precio total]),[ABCD]>1&&[EFGH]<>BLANK()),[EFGH])

Medida: CALCULATE(
SUM(Tabla1[Precio neto]),
FILTRO(Tabla1,Tabla1[Columna Countif]>1 && Tabla1[Precio neto] <>Blank()))Countif1.JPG

Source Community: Power BI
Syndicated - Inbound

Hola

Escriba esta medida

Medidas: SUMX(FILTER(SUMMARIZE(VALUES('Table1'[Product]),'Table1'[Product],"ABCD",CALCULATE(COUNTROWS('Table1'),Table1[Net Price]>0),"EFGH",[Total price]),[ABCD]>1&&[EFGH]<>BLANK()),[EFGH]))))))))))))))))))).)).)))))))))))))))))))))))))))))))))))))))))))))))/[ABCD]>1&&[EFGH]<>BLANK()),[EFGH]))))))))))))))))))________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Espero que esto ayude.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Source Community: Power BI
Syndicated - Inbound

Es brillante. Muchas gracias

Source Community: Power BI
Syndicated - Inbound

De nada.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Source Community: Power BI
Syndicated - Inbound

@Greg_Deckler ¿Piensas en hacerlo de todos modos. Muchas gracias

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)