cancel
Showing results for
Did you mean:

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Resolver II

Comparación de columnas de distintas tablas bajo una condición

Hola,
Estoy tratando de comparar los importes de las facturas de dos programas para ver cuáles no coinciden. Cada programa está en una tabla:
- account_invoice_programaA

- account_invoice_programa_B

Quiero ignorar las diferencias de hasta 5 céntimos, para lo que he utilizado el siguiente código:

``````Num distintos importes =
CALCULATE(
COUNT(account_invoice_programaB[id_programaA]),
FILTER(
account_invoice_programaB,
ROUND(account_invoice_programaB[importe_programaB],2) <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) - 0.01 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) - 0.02 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) - 0.03 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) - 0.04 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) - 0.05 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) + 0.01 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) + 0.02 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) + 0.03 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) + 0.04 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2) &&
ROUND(account_invoice_programaB[importe_programaB],2) + 0.05 <> ROUND(RELATED(account_invoice_programaA[importe_programaA]),2)
),
USERELATIONSHIP(dim_date[date_id], account_invoice_programaA[programaA_invoice_date_id])
)``````

Sin embargo, cuando pongo en una visualización las facturas, compruebo como aparecen muchas con 0,01€ y 0,02€ de diferencia entre importes, por lo que el código no está funcionando correctamente. ¿Alguien sabe qué puede estar ocurriendo? Muchas gracias!
1 ACCEPTED SOLUTION
Resolver II
Solución
CALCULATE
(
DISTINCTCOUNTNOBLANK(account_invoice_programaB[id_programaA]),
FILTER(
account_invoice_programaB,
ABS(account_invoice_programaB[importe_programaB] - RELATED(account_invoice_programaA[importe_programaB]))>0.05
),
USERELATIONSHIP(dim_date[date_id], account_invoice_programaA[programaA_invoice_date_id])
)
Resolver II
Solución
CALCULATE
(
DISTINCTCOUNTNOBLANK(account_invoice_programaB[id_programaA]),
FILTER(
account_invoice_programaB,
ABS(account_invoice_programaB[importe_programaB] - RELATED(account_invoice_programaA[importe_programaB]))>0.05
),
USERELATIONSHIP(dim_date[date_id], account_invoice_programaA[programaA_invoice_date_id])
)

Announcements

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors