Forum Discussion
DAX or Query: Compare two columns in different Tables
I have 2 tables and want to compare two columns (one from each) in query editor or dax. I just need a yes they (the text values) match or no (text values) don't match in a new column. Secondly I need a count of all the orders that do not match to table 2.
Table 1 (Primary Table)
| Order No | Order Status |
| 1234 | Resolved |
| 1235 | Pending |
| 1236 | Open |
| 1237 | Resolved |
| 1238 | Resolved |
| 1239 | Pending |
Table 2
| Order No | Order Status |
| 1234 | Open |
| 1235 | Resolved |
| 1236 | Pending |
| 1237 | Resolved |
| 1238 | Resolved |
| 1239 | Open |
I want a new column to be created (in either table) that shows when the Order status values in rows from each table match, as below:-
| Order No | Order Status | Column 3 |
| 1234 | Resolved | No Match |
| 1235 | Pending | No Match |
| 1236 | Open | Match |
| 1237 | Resolved | Match |
| 1238 | Resolved | Match |
| 1239 | Pending | No Match |
Do i need to do this as a merge query or dax ?
Thanks
Hi Anonymous
here you go
Attached the file
https://drive.google.com/file/d/1hMWpl1vwwXlj8yDKT8vmXLUF7S207jUU/view?usp=sharing
Hey add this to the measure if you don<t want to count the Blank rows
Count of MisMatch = CALCULATE(COUNTROWS(OEC_Service_Requests) , OEC_Service_Requests[Match/No Match__] = "No Match", OEC_Service_Requests[Status_Code ESR] <> BLANK())
22 Replies
- aj1973Community Champion
Hi Anonymous
here you go
Attached the file
https://drive.google.com/file/d/1hMWpl1vwwXlj8yDKT8vmXLUF7S207jUU/view?usp=sharing
- tulasi_pbi1988Helper I
Hi Anonymous
If the relationship is Many to Many means?
I have the same scenario to do, but I have Many to Many relationship.
Do you have anything like this, please?
Thank You
- aj1973Community Champion
What do you mean by like this????
Please open a new thread and send me examples where I can look into your issue. Every model is unique and different.
Thanks
- RookzieNew Member
Hello,
i tired to enter this in as a new coulum but all i got back was "match" when i know some dont match.any reason why this would happen?
- AnonymousNot applicable
aj1973 Thank you so much this worked! I need to do a count of the total orders that have mismatched in the 3rd table how do I do this?
- aj1973Community Champion
I just updated the file for you
- AnonymousNot applicable
Hi aj1973 unfortunatelty this didn't work 😞
The count is just giving me the count of all the rows in the 1st table not the new table created.
Also I have a change in requirement I need the 3rd table to show the order no, order status from both table 1 and 2, and new column to be created that shows when the Order status values in rows from each table match, as below:-
Order No Order Status (T1) Order Status
(T2)
Column 3 1234 Open Resolved No Match 1235 Resolved Pending No Match 1236 Pending
Open Match 1237 Resolved Resolved Match 1238 Resolved Resolved Match 1239 Open Pending No Match I am getting duplicate rows when I take both table columns however can see the match/no match values. whereas if I do your example way it shows me all values as no match