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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Tables A and B below are related by ID:
I want to add the "Value" column per ID - with the following conditions:
1-Valid = TRUE
2-Value >0 on aggregate.
That is, I'm expecting the results:
123 = -158, so it will not be added
456 is FALSE, so it will not be added
789 = 177. It will be added.
So, the end result is 177.
Solved! Go to Solution.
Hey @webportal ,
thank you very much, providing the file helped a lot.
I found my error, I filtered "Table B" wrong, so that we did the sum on duplicated rows.
I could solve that by summarizing by ID.
Please check the corrected measure, that should hopefully solve your problem:
Value Table B =
VAR _table =
FILTER(
ADDCOLUMNS(
SUMMARIZE(
FILTER( 'Table B', RELATED( 'Table A'[Valid] ) = TRUE ),
'Table B'[ID]
),
"SumValue", CALCULATE( SUM( 'Table B'[Value] ) )
),
[SumValue] >= 0
)
VAR result =
SUMX( _table, [SumValue] )
RETURN
result
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards
Denis
Blog: WhatTheFact.bi
Hey @webportal ,
thank you very much, providing the file helped a lot.
I found my error, I filtered "Table B" wrong, so that we did the sum on duplicated rows.
I could solve that by summarizing by ID.
Please check the corrected measure, that should hopefully solve your problem:
Value Table B =
VAR _table =
FILTER(
ADDCOLUMNS(
SUMMARIZE(
FILTER( 'Table B', RELATED( 'Table A'[Valid] ) = TRUE ),
'Table B'[ID]
),
"SumValue", CALCULATE( SUM( 'Table B'[Value] ) )
),
[SumValue] >= 0
)
VAR result =
SUMX( _table, [SumValue] )
RETURN
result
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards
Denis
Blog: WhatTheFact.bi
Nothing, it is just expensive, memory-wise, that's all 🙂
Hey @webportal ,
step by step, we will find the mistake 😉
Can you send me a screenshot of the Table B, if you want filtered to product 789 and a screenshot of the relationship between Table A and Table B?
Thank you and best regards
Denis
Hello @webportal ,
try the following measure:
Value Table B =
VAR _table =
FILTER(
ADDCOLUMNS(
FILTER( VALUES( 'Table B' ), RELATED( 'Table A'[Valid] ) = TRUE ),
"SumValue", CALCULATE( SUM( 'Table B'[Value] ) )
),
[SumValue] >= 0
)
VAR result =
SUMX( _table, [SumValue] )
RETURN
result
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards
Denis
Blog: WhatTheFact.bi
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!