Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Query to subtract column from different Table
07-20-2023
10:26 AM
Dear all,
Could you please kindly help with the querry to subtract 1 column from another table.
I have "table 1" with Column "No" Like the one below:
No |
A1 |
A2 |
A1 |
A2 |
A3 |
A4 |
A5 |
I have "Table 2" with Column "No_deleted" as following:
No_deleted |
A1 |
A4 |
How can I subtract Column "No" from table 1 to column "No_deleted" in table 2, and putting the result like following:
No | Result |
A1 | 0 |
A2 | A2 |
A1 | 0 |
A2 | A2 |
A3 | A3 |
A4 | 0 |
A5 | A5 |
Thank you very much for your help.
Best regards,
Solved! Go to Solution.
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023
12:10 PM

Hi, @MightyRabbit
try to use calculate and all with IF and NOT DAX func
the code will be something like
Result =
CALCULATE(
IF(
NOT(CONTAINS(table2, table2[No_deleted], table1[No])),
table1[No],
"0"
),
ALL(table2)
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023
12:10 PM

Hi, @MightyRabbit
try to use calculate and all with IF and NOT DAX func
the code will be something like
Result =
CALCULATE(
IF(
NOT(CONTAINS(table2, table2[No_deleted], table1[No])),
table1[No],
"0"
),
ALL(table2)
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!

Helpful resources
Recommendations
Subject | Author | Posted | |
---|---|---|---|
04-13-2024 01:19 PM | |||
08-21-2019 01:46 PM | |||
05-23-2024 01:24 PM | |||
08-14-2024 11:19 AM | |||
10-23-2023 01:15 AM |
Top Solution Authors (Last Month)
User | Count |
---|---|
30 | |
24 | |
24 | |
13 | |
9 |
Top Kudoed Authors (Last Month)
User | Count |
---|---|
24 | |
19 | |
16 | |
13 | |
9 |