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
Anonymous
Not applicable

¿Cómo hacer un doble DISTINCTCOUNT?

Hola a todos,
Mi tabla sigue esta estructura:

ArtículoCódigoClase
Fff15.1A
Fff16.1B
Yyy15.1A
Yyy15.1A
Yyy20.1A
Xxx16.1C

Como puede ver, un elemento puede aparecer más de una vez en la tabla. El código también se puede repetir. Quiero crear una medida que cuente los distintos tipos de código para cada elementodistinto .


Por lo tanto, sobre la base de la tabla de ejemplo anterior, la medida debe traerme de valor 5, porque:
FFF tiene 2 códigos distintos (15.1 y 16.1)
YYY tiene 2 códigos distintos (15.1 y 20.1)
XXX tiene 1 código distinto (16.1)

Así que 2 + 2 + 2 x 5

¿Alguien puede ayudarme?


1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hola

Esta medida funciona

SUMX(SUMMARIZE(VALUES(Data[Item]),Data[Item],"ABCD",DISTINCTCOUNT(Data[Code])),[ABCD])

Espero que esto ayude.


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

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hola

Esta medida funciona

SUMX(SUMMARIZE(VALUES(Data[Item]),Data[Item],"ABCD",DISTINCTCOUNT(Data[Code])),[ABCD])

Espero que esto ayude.


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

Puede utilizar esta expresión de medida, reemplazando Table por el nombre real de la tabla.

Elemento y código distintos: COUNTROWS(SUMMARIZE(Table, Table[Item], Table[Code]))

saludos

palmadita





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


ryan_mayu
Super User
Super User

@req7

se puede probar esto

Measure = 
VAR _TBL=SUMMARIZE('Table','Table'[Item],"_count",DISTINCTCOUNT('Table'[Code]))
return SUMX(_TBL,[_count])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hey @ryan_mayu
Traté de crear esta medida suya aquí, pero me da un error en la parte de "retorno" (expresión inesperada). ¿Cómo puedo crear su medición sin que me pase este error?

jthomson
Solution Sage
Solution Sage

Si solo hace un recuento distinto en la columna Código y, a continuación, pega la columna Elemento como filas en una matriz, ¿debería darle los resultados que desea?

Anonymous
Not applicable

Hola @jthomson
Lo siento, no entendí la parte de la matriz. ¿Sería una medida creada?

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.