Forum Discussion
Help with relationships
- 4 years ago
Sounds like in your Weights database that the Part Group is not unique. Best way to tell: Add that column THREE times to a table visual. Leave the first one as it is, change the aggregation of the second to DISTINCT COUNT, and change the aggregation of the third to COUNT. Now look at the bottom numbers. If the COUNT = DISTINCT COUNT then the Part Group values are unique.
If you can get the Part Group values to be unique in the Weights database, then the relationship can be One-to-One, which makes sense for your mode.
In your Power Query, try aggregating the Weights Database by Part Group. Include aggregations like Average, Min, Max, and Row Count.
Think about it, you have identified a single Part Group in the Grouping database, and you want to know its Weight, so you traverse the relationship to the Weights database and see that there are TWO or more weights listed for that one Part Group. Which to choose? You have to get the Weights database down to ONE ROW per Part Group and an AGGREGATION in Power Query is an easy way to do it.
Thanks so much for all your help, the relationships are created as you described now, Just one more thing seems to be off. When i combine the grouping database and weights database to make a table, the table shows the same number weight for all Groupings, which i know is not correct, it seems to still be just counting entries. For example, when trying to display Groupings by weight, it reads the same number, which is odd. Once again thanks for all your help
- ToddChitt4 years agoSuper User
What do you mean by "combine the grouping database and weights database to make a table"?
Do you mean you are making a table visual on a report page, and adding the Grouping from the Group table and the Weight from the Weights table?
Do you have a one-to-one relationship set up between the two?
Can you show some sample data?
- Kieran-q_204 years agoHelper I
My apologies for the late response, my work shuts down for the weekend. Yes sorry i meant to say im making a table visual on a report page by adding the groupings from the grouping table and the weight from the weight table.
I do indeed have a 1 to 1 relationship between them and below is a snapshot of the relationships
I'm not sure if i can show much sample data, but i can show the difference in the actual returns table and the Weight table.
As you can see the weight table, which is on the right is identical across all rows, but the reutrns table works perfectly. The actual reutnrs table uses, Actual returns from the Base datatable, Groupings from the grouping database table and quarter from the base data table.
The weight table however uses, quarter from the base data table, groupings from the grouping database and Gross weight from the weight database.
- ToddChitt4 years agoSuper User
As displayed, the Groups table cannot 'filter' the Weights table because the FILTER DIRECTION on the relationship (from Base to Weights) is "one-way".
Two options:
- Remove the relationship from Base to Weights, and activate the relationship (dotted line = not active) between Groups and Weights.
- Change the Cross Filter Direction of both active relationships from "Single" to "Both"
As a general rule, I never keep around in-active relationships in my models. They just clutter things up and don't contribute to anything.
Either one of the above two actions should allow the Groups database to 'filter' the Weights database.
Hint: Table can only 'filter' other tables when the relatinship lines 'point' from one to the other. In your current state, Groups 'point to / can filter' Base, and Weights 'points to / can filter' Base. With bi-directional filtering turned on, Base would be alble to filter the other two. The net result of that would be that Groups would 'filter' Base, and Base would in turn 'filter' Weights.
Hope that helps.