Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

sum a column value based on another table column

I have a table1 with 2 columns A & B which has value like below 

A            B
p11
p13
p24
p76

 

Another table 2 with column A

A
p2
p3
p6
p8
p10

 

Both the tables are connected via dimension table table3 (union of table1 & Table2 )which looks like 

A
p1
p2
p3
p6
p7
p8
p10
p12

 

I wanted to sum the column B of table1 where column A of table1 is not matching with Column A of table 2 .

Desired O/P : (1+3+6)=10

I am using calculate with Filter using Values but not getting correct output .

1 ACCEPTED SOLUTION
Anonymous
Not applicable

After modification it works . Thanks Amitchandak .

measure=
var _tab = except(selectcolumns(Table1,"col",Table1[A]),selectcolumns(Table2,"col",Table2[a]))
return
calculate(sum(Table1[b], filter(Table1,Table1[A] in _tab))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

measure=
var _tab = except(allselected(Table1[A]),allselected(Table1[b]))
return
calculate(countrows(Table1), filter(Table1,Table1[A] in _tab))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks for such a quick response , I made a little modification to make it work but the problem is it does not work properly when filter is applied 

Anonymous
Not applicable

After modification it works . Thanks Amitchandak .

measure=
var _tab = except(selectcolumns(Table1,"col",Table1[A]),selectcolumns(Table2,"col",Table2[a]))
return
calculate(sum(Table1[b], filter(Table1,Table1[A] in _tab))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.