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! Request now

Reply
Brains86
Frequent Visitor

Calculate Sum of table1 column1 based on table 1 column 2 and table 2 column 2 or not equal

I have 3 tables: 

1. company (company_id, name, adres, etc..)
2. quotes (quotes_id, company_id, value, project_number etc..)
3. orders (orders_id, company_id, value, project_number)

The tables are 1 to many connectect through company_id

 

Table 2 quotes:

quotes_idcompany_idvalueproject_number
15510020201
2551020202
357200020203
4582020204


Table 3 orders:

orders_idcompany_idvalueproject_number
15510020201
257200020203
3532520208
45830020209

 

I want to formulate a DAX formule which counts the value of de orders (order[value]) but only from project number (orders[project_number]) that don't exist in de quotes table (quotes[project_number])

 

So in this case the result should be 25 + 300 = 325. 
please help. 

1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

First thing: create a calculated column in the Order table as follows:

1) BOOLEAN = IF(LOOKUPVALUE('Quotes'[project_number], 'Quotes'[project_number], 'Orders'[project_number])=BLANK(), 0, 1)
Then create a measure as follows:
2) Misura = CALCULATE(SUM('Orders'[value]), 'Orders'[BOOLEAN] = 0)
 
I hope it is for you!
B.

View solution in original post

1 REPLY 1
BeaBF
Super User
Super User

First thing: create a calculated column in the Order table as follows:

1) BOOLEAN = IF(LOOKUPVALUE('Quotes'[project_number], 'Quotes'[project_number], 'Orders'[project_number])=BLANK(), 0, 1)
Then create a measure as follows:
2) Misura = CALCULATE(SUM('Orders'[value]), 'Orders'[BOOLEAN] = 0)
 
I hope it is for you!
B.

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.