Forum Discussion

GTheunissen's avatar
GTheunissen
Regular Visitor
4 years ago
Solved

extract rows in table based on other table

I have two tables. One table exist the names of rows i want to execute in the second table. 

 

How can I do that? 

This column names need to be executed in this table: 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi GTheunissen ,

     

    So you want to filter the second table for usernames that are common to the first table?

     

    If so, you can try this measure to filter:

    Measure = IF(SELECTEDVALUE('Table 1'[username]) in VALUES('Table 2'[Column2]),SELECTEDVALUE('Table 2'[Column2]))

     

    the result will as the image shows:

    If this way meets your needs, you also can view my testing pbix file.

     

    Best regards,

    Community Support Team Selina zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

5 Replies

  • Samarth_18's avatar
    Samarth_18
    Icon for Community Champion rankCommunity Champion

    Hi GTheunissen ,

     

    Your question is not much clear.  Could you please explain with examples and also share your sample data in text format not a screenshot.

     

    Note:- One suggestion kindly promote your first row as a header in table 2 as shown below:-

     

     

    BR,

    Samarth

  • Jeanxyz's avatar
    Jeanxyz
    Icon for Power Participant rankPower Participant

    If you want to filter table 1 based on the companies that exist in table 2, you can merge tables in Power Query. 

    step 1. Merge table1 and 2 based on company name

    step2. expand company name column from table 2

     

    step 3. export the merged table3

    There are different ways to export the data, here I simply copy the whole table3 and paste it to Excel. You can filter out the null values in tab2: Company Name before copy data. 

    • Jeanxyz's avatar
      Jeanxyz
      Icon for Power Participant rankPower Participant

      yes, table 1 merges with tab2 based on column company name.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi GTheunissen ,

     

    So you want to filter the second table for usernames that are common to the first table?

     

    If so, you can try this measure to filter:

    Measure = IF(SELECTEDVALUE('Table 1'[username]) in VALUES('Table 2'[Column2]),SELECTEDVALUE('Table 2'[Column2]))

     

    the result will as the image shows:

    If this way meets your needs, you also can view my testing pbix file.

     

    Best regards,

    Community Support Team Selina zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly