Forum Discussion
Filtering with many-to-many relationship
- 7 years ago
You should be able to do this with your existing tables with a measure like the following:
In Table1 missing in Table2 = IF( HASONEVALUE(Table1[OrderID]), Var _table1OrderID = MAX(Table1[OrderID]) Var _table2RowsWithTable1ID = CALCULATETABLE(Table2, TREATAS({_table1OrderID},Table2[OrderID])) Var _countOfMIssingRows = COUNTROWS(_table2RowsWithTable1ID) return IF(_countOfMissingRows = 0,"Missing") )Returns a result like this
Thanks for putting some much time and effort into this question. I still have the same problem. See attached .gif.
Is that a test model that you could upload to somewhere? If you have a bi-directional many to many relationship I can't think why table2 filters table1, but not the other way around.
- Anonymous7 years agoNot applicable
I copied the values from the tables and found out the directquery add's two spaces. I transformed the column with trim and it works..
Thanks!
- d_gosbell7 years ago
Super User
Anonymous wrote:I copied the values from the tables and found out the directquery add's two spaces. I transformed the column with trim and it works..
So technically I think you'll find that the extra spaces are in the source tables, not added by DirectQuery, but I understand what the issue is and I'm glad you found the solution. :)