Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Filter table based on another table

Hi,

 

I would like to filter numbers out based on if they exist in another table.

 

Example given.

 

Table 1 consist 

ID     Text Field

 

Table 2 consist 

ID

 

 

I'd like to filter Table 1, removing all the rows where the number from Table 2 ID exist.

 

I've tried by making a new table with Column = EXCEPT(VALUES(Table1[ID]);VALUES(Table2[ID])) 

 

Which gives me a new table that filters perfectly. however I need to keep my second column "Text Field".

 

Any ideas?

  • Anonymous's avatar
    Anonymous
    8 years ago

    Anonymous,

    Use the DAX below instead.

    Table = CALCULATETABLE(Table1;EXCEPT(VALUES(Table1[ID]);VALUES(Table2[ID])))



    Regards,

    Lydia

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous,

    Use the DAX below instead.

    Table = CALCULATETABLE(Table1;EXCEPT(VALUES(Table1[ID]);VALUES(Table2[ID])))



    Regards,

    Lydia

    • Prashant354's avatar
      Prashant354
      New Member

      What if I want to keep the values in table 2 and filter out the remaining values from table 1?

      • Anonymous's avatar
        Anonymous
        Not applicable

        I believe you can use INTERSECT instead of EXCEPT

    • SG_17's avatar
      SG_17
      Frequent Visitor

      Anonymous  I am trying to do something similar, but do not want to build another table.  Instead, I want to calculate measures based on the filter that will be visualized on a matrix in a report. For example:

      Table A

      IDCostRevenue
      1124
      1235
      1337
      14511

       

      Table B (discontinuation)

      ID
      11
      12

       

      Matrix on report:

       Before DiscAfter Disc
      Total Cost138
      Total Revenue2718

       

      Any recommendations?  Thank you!!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks alot! Works like a charm!