Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Good morning.
I have a table of transactions of different companies, these can make contracts between them (contracts table). I need to construct a table that shows me the result of these contracts as a difference of transactions between the buyer and seller (result table), as shown in the following image. Thanks for the support.
Solved! Go to Solution.
Hi @rpachecol ,
Please try to create the following measure.
VALOR* =
SWITCH (
MAX ( 'CONTRATOS'[CONTRATO] ),
"EMPRESA 1-EMPRESA 2",
CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 1" )
)
- CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 2" )
),
"EMPRESA 2-EMPRESA 4",
CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 2" )
)
- CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 4" )
)
)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @rpachecol ,
Please try to create the following measure.
VALOR* =
SWITCH (
MAX ( 'CONTRATOS'[CONTRATO] ),
"EMPRESA 1-EMPRESA 2",
CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 1" )
)
- CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 2" )
),
"EMPRESA 2-EMPRESA 4",
CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 2" )
)
- CALCULATE (
SUM ( 'TRANSACCIONES'[VALOR] ),
FILTER ( 'TRANSACCIONES', [EMPRESA] = "EMPRESA 4" )
)
)
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You need to merge your data in power query
Two merges In Contract table add valor :
First merge to add Comprador Valor (link comprador - empresa)
Second merge to add Vendedor Valor (link vendedor - empresa)
Then you should be able to substract values.