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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to sum cells which are also present in mapping table?

Hi all,

 

How do I create a measure that does the following:

Sum table 1[column A] for all rows where table 1[column B] is equal to a value in table 2[column C]

 

Right now I am writing it as:

Measure 2 = Calculate(SUM(Table1[ColumnA]), Table1[ColumnB]=Table2[ColumnC])
 
But PowerBI is returning an error "The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression."
 
In Excel, I would write this as:
SUMIF(ColumnB, Table2'ColumnC', ColumnA)
 
Please help.
 
Thanks!
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , if they have one to many relation


Measure 2 = Calculate(SUM(Table1[ColumnA]), filter(Table1,Table1[ColumnB]=related(Table2[ColumnC])))
or
Measure 2 = Calculate(SUM(Table1[ColumnA]), filter(Table2,Table2[ColumnB]=related(Table1[ColumnC])))

Measure 2 = Calculate(SUM(Table1[ColumnA]), filter(Table1,Table1[ColumnB]=max(Table2[ColumnC])))
for some row context // group by


Measure 2 = Calculate(SUMX(value(Table1[ID]), Table1[ColumnA]), filter(Table1,Table1[ColumnB]=max(Table2[ColumnC])))

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

When I use either one of the two first options, PowerBI tells me it is unable to find Table2.  This is strange as there exists a join between Table2 and Table1.  I am unable to make any changes in the model view due to permissions.  Do you know what could be the cause for the measure not working?

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.