The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 | |
ID | Pounds |
A | 10 |
B | 10 |
C | 10 |
D | 10 |
E | 10 |
Table 2 | ||
ID | Pounds | In Table 1 |
A | 10 | Y |
B | 10 | Y |
F | 15 | N |
C | 10 | Y |
G | 15 | N |
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!
@SeaDiegoFC , if they are not join
A meausre like
calculate(Sum(Table2[Pounds]), filter(Table2, Table2[ID] in values (Table1[ID]) ))
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!