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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Impactful Individual
Impactful Individual

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
Impactful Individual
Impactful Individual

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors