Forum Discussion
Comparing Two Columns from different tables and list out un-matched records.
Dear experts,
Please help me by providing the solution to the query: by comparing two columns of the same kind and listing out the unmatched records. The logic should read "common company" and "common order" from both tables, compare line numbers from both tables, and return unmatched line numbers as shown in the output table.
For Example:
Table1:
Company Order Line Number
PBLG 319816 10
PBLG 319816
PBLG 319816
DNKA 319734 10
DNKA 319734 20
DNKA 319734
DNKA 319734 40
PBLG 331606 20
PBLG 331606 30
PBLG 331606 40
PBLG 331606 50
Table2:
Company Order Line Number
PBLG 319816 10
PBLG 319816 4
PBLG 319816 5
DNKA 319734 10
DNKA 319734 20
DNKA 319734 30
DNKA 319734 40
PBLG 331606 20
PBLG 331606 30
PBLG 331606
PBLG 331606
Output:
| Comapny | Order | Resul Column |
| PBLG | 319816 | Missing Lines: 4,5 |
| DNKA | 319734 | Missing Lines: 30 |
| PBLG | 331606 | Missing Lines: 40,50 |
Thanks,
Sareen
6 Replies
- djurecic
Super User
Hi Anonymous ,
You can get most of the way there using the EXCEPT function:
- AnonymousNot applicable
Hello djurecic ,
Thanks for your inputs on my query. I tried to using EXCEPT Dax for comapring two Line Numbes from diffrent tables by creating Variables. But Power BI thowns this error.Note: Two Line Numbers columns from two different tables and tables having indirect mapping.
Could you pleaes help on it.Thanks,
Sareen
- djurecic
Super User
Hi Anonymous ,
With EXCEPT, you need to use the table name, not a selectedvalue from a table.
- AnonymousNot applicable
Tried as you mentiones, but need to compare two columns in in different tables with EXCEPT.
Can you please eloborate with query for comapring two columns.Thanks,
Sareen
- v-yinliw-msft
Community Support
Hi Anonymous ,
You can try this method:
New a table:
Table = UNION ( EXCEPT ( 'Table2', 'Table1' ), EXCEPT ( 'Table1', 'Table2' ) )The result is:
Result = FILTER('Table','Table'[Line Number] <> BLANK())Hope this helps you.
Here is my PBIX file.
Best Regards,
Community Support Team _Yinliw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.