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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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