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 combinar dos medidas

Hola a todos,

Mi tabla sigue esta estructura:

ArtículosCódigoClasificación
Xxx5D
Xxx3D
Yyy3H
Zzz2D
Zzz1K
Zzz2D

Tengo dos medidas:

* measure1 es una medida que me trae un recuento DISTINCT de todos los artículos que tienen una clasificación K o H o R. (sólo para la clasificación H, el conteo sólo se hace si el Código no es 3)

measure1 - CALCULATE(DISTINCTCOUNT(table[Items]),FILTER(table, IF(SEARCH("K",table[Classification],,0) && NOT( SEARCH("3",table[Code],,0)),TRUE,FALSE) SEARCH("H", tabla[Clasificación],,0 ? SEARCH("R", tabla[Clasificación],,0) ),TRUE,FALSE)))

*measure2 es una medida que cuenta todos los elementos DISTINCT de mi tabla que tienen códigos 1 o 2 o 3.

measure2 - CALCULATE(DISTINCTCOUNT(table[Items]),FILTER(table, IF(table[Code]-"1" á table[Code]-"2" á table[Code]-"3" ,TRUE,FALSE)))

Quiero fusionar estas dos medidas de manera que las condiciones de la medida2 se puedan llevar a cabo SOLAMENTE en los elementos traídos por measure1. Basándose en la tabla de ejemplo anterior, el nuevo measeure debe traerme el valor 1, porque sólo el elemento ZZZ coincide con las dos medidas.

¿Alguien puede ayudarme?

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

hola @req7

para lamedura combinada, podría probar esta lógica simple:

MergedMeasure = CALCULATE(DISTINCTCOUNT('Table'[Items]),FILTER('Table',[measure1]*[measure2]<>BLANK()))

Por cierto, su medida1 es incorrecta, podría usar la medida1 de DataZoe en lugar de la suya.

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

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hola @req7

para lamedura combinada, podría probar esta lógica simple:

MergedMeasure = CALCULATE(DISTINCTCOUNT('Table'[Items]),FILTER('Table',[measure1]*[measure2]<>BLANK()))

Por cierto, su medida1 es incorrecta, podría usar la medida1 de DataZoe en lugar de la suya.

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.
DataZoe
Employee
Employee

@req7 Creo que esto es lo que estás buscando:

Medida combinada (Combo Measure)
IF ( ISBLANK ( [Medida 2] ), BLANK (), [Medida 1] )

También redifiqué tu Medida 1 y Medida 2, lo que habías escrito no funcionó para mí.

Medida 1 ?
CALCULAR (
DISTINCTCOUNT ( 'Tabla'[Artículos] ),
FILTRO (
'Mesa',
'Tabla'[Clasificación] EN "K", "R"
|| ( 'Tabla'[Clasificación] - "H"
&& 'Tabla'[Código] <> 3 )
)
)

Medida 2 ?
CALCULAR (
DISTINCTCOUNT ( 'Tabla'[Artículos] ),
FILTRO ( 'Tabla', 'Tabla'[Código] EN S 1, 2, 3 ? )
)

DataZoe_0-1600480109731.png

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

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.