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

Comparar columnas de tablas distintas

Buenos días,

 

Tengo dos tablas con dos columnas cada una. Quiero sacar las filas que no coinciden entre ambas columnas, el problema es que entre todas las columnas pueden coincidir y ser de verdad únicas. Para arreglar este posible fallo, creo una tercera columna y concateno las otras dos columnas de cada tabla. En este punto quiero comparar las dos columnas concatenadas (Una de cada tabla), de tal forma que me muestre las que no coinciden y así ver las que no aparecen.

 

Saludos

1 ACCEPTED SOLUTION

Hi @alejandroezp ,

 

I'm sorry if I misunderstood you, but if you want to know the number of rows, please change the measure to:

NonMatching_rows = 
COUNTROWS(
    EXCEPT(
        SELECTCOLUMNS(Table1, "ConcatenatedColumn1", Table1[ConcatenatedColumn1]),
        SELECTCOLUMNS(Table2, "ConcatenatedColumn2", Table2[ConcatenatedColumn2])
    )
)

Best Regards,

Neeko Tang

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

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @alejandroezp ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data.  

Table1:

vtangjiemsft_0-1688436104124.png

Table2:

vtangjiemsft_1-1688436119593.png

(2) Create series columns in Tables 1 and 2, respectively.

 

ConcatenatedColumn1 = CONCATENATE(Table1[Column1], Table1[Column2])
ConcatenatedColumn2 = CONCATENATE(Table2[Column1], Table2[Column2])

 

(3)We  can create a table.

 

NonMatching = 
    EXCEPT(
        SELECTCOLUMNS(Table1, "ConcatenatedColumn1", Table1[ConcatenatedColumn1]),
        SELECTCOLUMNS(Table2, "ConcatenatedColumn2", Table2[ConcatenatedColumn2])
    )

 

Please refer to the following document for more information.

EXCEPT function (DAX) - DAX | Microsoft Learn

 

(4) Then the result is as follows.

vtangjiemsft_2-1688436282014.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

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

Buenos días,

He probado la solución y no me ha funcionado. Adjunto algunos datos y especifico mejor el proceso:

En las tablas concatenamos las columnas "Company" y "Name", después comparamos el resultado de concatenar la tabla1 y la tabla2. Al comparar el resultado de concatenar la tabla1 y la tabla2 quiero sacar el número de filas que no coinciden, es decir, las filas concatenadas que ,buscando desde la tabla1 en la tabla2, no aparecen en la tabla2 y que me indique el número de filas.

 

Tabla1:

CompanyCategoryTypeItemName
ONO ESPAÑA CLIENTESHARDWAREINFRAESTRUCTURASONDAKP113
R59199 - CELTA, S.A.HARDWAREEQUIPAMIENTO VOZTERMINAL FIJOXP152
R2803408 - ORDENADORES MANOLO, S.A.HARDWAREPERIFERICOSOTROS (PERIFERICOS)VISTA345
T417101I - UCMHARDWAREACCESORIOSADAPTADORUX83491
R4545903 - SANTANDER, S.A.HARDWAREEQUIPAMIENTO VOZTARJETA VOZux09133
R3033515 - ALBACET Y ASOCIADOS S.A.HARDWAREPERIFERICOSMONITORQW7321
Q82007A - IKEAHARDWAREEQUIPAMIENTO VOZTERMINAL FIJOI8329
R2803408 - ORDENADORES MANOLO, S.A.HARDWAREPERIFERICOSOTROS (PERIFERICOS)K8341

Tabla2:

CLASSIDCOMPANYNAMESHORTDESCRIPTION
EQUIPMENTONO ESPAÑA CLIENTESZV7728MICRO
EQUIPMENTONO ESPAÑA CLIENTESKP113DISCO DURO
EQUIPMENTT417101I - UCMUX83491PANTALLA
EQUIPMENTR2803408 - ORDENADORES MANOLO, S.A.BV5591CD
EQUIPMENTR4545903 - SANTANDER, S.A.ux09133PC
EQUIPMENTR59199 - CELTA, S.A.YW2189PANTALLA
EQUIPMENTR2803408 - ORDENADORES MANOLO, S.A.MC2044PANTALLA
EQUIPMENTR2803408 - ORDENADORES MANOLO, S.A.K8341DISCO DURO

 

Saludos

Hi @alejandroezp ,

 

I'm sorry if I misunderstood you, but if you want to know the number of rows, please change the measure to:

NonMatching_rows = 
COUNTROWS(
    EXCEPT(
        SELECTCOLUMNS(Table1, "ConcatenatedColumn1", Table1[ConcatenatedColumn1]),
        SELECTCOLUMNS(Table2, "ConcatenatedColumn2", Table2[ConcatenatedColumn2])
    )
)

Best Regards,

Neeko Tang

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

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.