Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Measure across two tables

Hi   Noob here. I'm trying to count number of rows in one table, based on a comparison that involves a second table. I've been reading about innerjoin and relatedtables, but I don't understand it...
  • PaulDBrown's avatar
    PaulDBrown
    6 years ago

    Anonymous 

     

    It is highly recommended to have relationships as one-to-many. It's easy to solve, and in fact, if you do not need to keep all rows iin your "Tools_Idefix_Order_Pane" table for some calculation (counting rows or something of that sort), you can simply remove duplicate rows in Power Query in this table and then proceed with loading to the model and creating the one-to-many relationship.

    For the sake of this exercise, however, I'm assuming you need to keep the original "Tools_Idefix_Order_Pane" table intact. So we are going to create a new table which will be referenced to this "Tools_Idefix_Order_Pane" (so that any changes in the data source are reflected in the new table), and set it up as a lookup table for your model.

    to proceed, go into Power Query and:

    1) select your "Tools_Idefix_Order_Pane" table,

    2) right click on it and choose "Reference" form the dropdown

     

    this will create a new table (same as your original "Tools_Idefix_Order_Pane" table). Change its name (in my example I've called it Table B lookup).

    3) now select the column, and in the Home tab, go to "Remove Rows" and select "Remove Duplicates"

     

    4) Now select "close and Apply" to load the tables into the model and close Power Query.

    5) go to the modeling pane and join you GUID column from your lookup table to your other table in a one-to-many relationship

    it should look like this:

     

    6) build the visual using the column from this lookup table

     

    Let us know if you encounter any problems!