Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hola!
Quiero calcular el número de valores que no coinciden entre dos columnas de dos tablas diferentes.
En mi caso, tengo una tabla de facturas (fact_sale_invoice) y otra de ventas (fact_sale_order) relacionadas a través de una tabla intermedia (rel_sale_order_invoice). Quiero hallar cuántos valores hay distintos entre las columnas de extended_amount de ambas tablas:
Esto es lo que he intentado, aunque de forma fallida (soy nuevo en esto y no estoy muy seguro del uso de SELECTEDVALUE):
PV_descuadrados =
IF(
SELECTEDVALUE(fact_sale_order[sales_amount])<>SELECTEDVALUE(fact_sale_invoice[invoice_amount]),
COUNT(fact_sale_order[sale_order_id]),
0
)
Gracias!!
No se puede realizar de alguna forma sin tener que generar una tabla nueva que tenga las dos columnas que me interese? Es decir, no existe una expresión DAX que permita comparar valores de dos tablas distintas?
Mil gracias!!
Hi @powerbi2srm ,
I created some data:
Table1:
Table2:
Intermediate tables:
Directly in the measure using two columns for comparison, there may be a Cartesian product, you can consider doing it in the calculated column.
Here are the steps you can follow:
1. Create calculated column.
Create calculated column pull indexes in two tables:
Table1Index =
SUMX(FILTER(ALL('Intermediate tables'),'Intermediate tables'[ID]='Table'[ID]),[Index])Table2Index =
SUMX(FILTER(ALL('Intermediate tables'),'Intermediate tables'[ID2]='Table2'[ID2]),[Index])Table2_amount =
SUMX(FILTER(ALL('Table2'),'Table'[Table1Index]='Table2'[Table2Index]),[Amount])Flag =
IF(
'Table'[Table2_amount]='Table'[Amount],1,0)Value =
IF(
[Flag]=1,COUNTX(FILTER(ALL('Table'),[Flag]=1),[ID]),0)
2. Result:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 23 | |
| 21 | |
| 20 | |
| 18 | |
| 13 |
| User | Count |
|---|---|
| 58 | |
| 51 | |
| 38 | |
| 31 | |
| 26 |