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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SeaDiegoFC
New Member

Calculating the sum of a column based on a filter on another column

Hi,

 

I'm brand new to Power BI and DAX and I am running into some trouble attempting to sum a column with a measure based on filtering the table on a different column. I have read online and I think I almost have it, but I am running into an issue getting the final result to be correct.

 

The column I want to filter on was created from another measure, where it was filled in by comparing two columns in separate tables. The tables are:

 

Table 1
IDPounds
A10
B10
C10
D10
E10

 

Table 2
IDPoundsIn Table 1
A10Y
B10Y
F15N
C10Y
G15N

 

I used this measure to create the column "In Table 1":

In Table 1 =
IF (
ISBLANK ( LOOKUPVALUE ( 'Table 1'[ID], 'Table 1'[ID], 'Table 2'[ID] ) ),
"N",
"Y"
)

 

And now I am trying to get the sum of Pounds in Table 2 but only for those ID's not found in Table 1. This is the measure I attempted:

 

Sampled, Not in Table 1 =
CALCULATE (
SUM ( 'Table 2'[Pounds] ),
FILTER ( 'Table 2', 'Table 2'[In Table 1] = "N" )
)

 

When I run this measure, rather than get the correct total of 30, I get a blank. If I change the filter to "Y" in the above measure, I get a result of 60, as it sums the entire column regardless of "Y" or "N." I'm not sure if the issue is with the first measure creating the filtering column or in the second measure where I am attempting to filter and sum.

 

Any help would be greatly appreciated! Thank you!

2 REPLIES 2
amitchandak
Super User
Super User

@SeaDiegoFC , if they are not join

 

A meausre like

 

calculate(Sum(Table2[Pounds]), filter(Table2, Table2[ID] in values (Table1[ID]) ))

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

Hi @amitchandak,

 

This sums the pounds where the ID's are shared between the two tables, is there a way to have it sum the unique ID's in Table 2 that are not present in Table 1?

Thank you!

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.