Forum Discussion
beginner guide to learn Power BI
- Anonymous8 years ago
The unique values only need to exist in 1 of the 2 tables, hopefully that is not tripping you up. The relationship is often either 1:1 (1 to 1) or 1:* (1 to Many). Once you get your head around it, its very easy. I'll give you an example that might make it click.
You have a list of employees, who are your sales staff. You have a list of sales and what they sold for. You want to know how much each person sold over all.
In your sales list, rather than recording each person by name, you want to record using an ID that wont change. Imagine if one of your female staff members got married and their named changed? You'd have to correct all those records. So instead we will use a unique Employee number. In a real scenario this might be an interal ID number the system generates, or a payroll number that is used elsewhere in the company.To hold all this employee data, you would have a sepearate table with your staff. Since its a staff listing, each staff member will be mentioned once and have their ID listed here too. In Power BI you can now link the 2 tables together via the ID column.
What about if you don't have an ID column to use? Well, there might be instances where the propeties of the data makes it unique. So while a single column isn't unique, severnal columns together might be. In DAX or Power Query you could create a new column and have it equal the contents of the other columns together (use & to join them). You can then join your tables on that created field. You would also need the other tables to have a column with the same method of concatenation. This would need to be exactly the same, same order, same spelling, everything. You would also need to make sure that one of the tables has 1 row for each entry you want to relate. Just like how in our Employees table, each employee only appears a single time. In this new complex example, one of these tables would have that single row per instance. If both of your tables don't have this, you might need to create a 3rd table, where you only list each circumstance once, then link your existing tables through this reference table.Does that help you?