Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
GiangLe
Helper I
Helper I

beginner guide to learn Power BI

hi everyone,

 

I'm a power bi rookie. I have done some researches and self-learning myself (learning materials from microsoft, udemy) and i thought i had known it all until i actually try to make a dashboard myself in which i had to interact with my data in the relationships. Those courses i took, they mainly introduce the visualization function of power bi (the reports part). Could anyone point me to the right direction where i can learn more about creating relationships between my data?

For example, the thing that i'm struggling with atm: making unique key in 2 tables so i can create relationships between them. My colleague uses concatenate function to create a unique key and from there create a relationship between my data tables. This prob not the only way, could you point me to where i can learn/read more about this.

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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?

View solution in original post

7 REPLIES 7
EnterpriseDNA
Kudo Kingpin
Kudo Kingpin

Recommendation to start here with these free courses & resources
Ultimate Beginners Guide to Power BI
Ultimate Beginner Guide to DAX
Free Power BI resource downloads available here
 
Review some recent free training workshops from Enterprise DNA for some real-world application of Power BI (links below)
Discovering Advanced Insights w/Power BI - https://www.youtube.com/watch?v=XzgNUYz8_TI&t=308s
Effective Power BI Reporting - https://www.youtube.com/watch?v=HwawCW_3mI4
 
For advanced training check out all the courses and resources available at Enterprise DNA Online
 
Also Enterprise DNA TV for Power BI topic deep dives
Anonymous
Not applicable

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?

Hi Ross, thank you very much for your quick reply. it's indeed very helpful to get start 🙂

I understand the first, easy part of your example. let's me rephrase your last paragraph where you introduce a more complicated problem. so in order to make the new unique column (joint of many columns) work in my data tables. this new column need to be created identically in both tables? but that contradicting with what you said earlier "The unique values only need to exist in 1 of the 2 tables".

 

The technique i usually use to link my tables is via a new table which i created by appending those tables and remove all the unnecessary columns and duplicated, null values. 

 

And my question regarding tutorials, books to learn more about this still stand 😛 because all the courses that i've happend to come across only deal with the visualization part of power bi and that's obviously not everything 😞

Anonymous
Not applicable

Sounds like you are getting a good grasp on it.  The concepts springboard into general database design.  If you find a course that teaches either database design or database administration, you should get further down that rabbit hole.  Its a pretty deep well which you don't need all of it for Power BI.  Lots of different courses touch on these points.  I did a Pluralsite course recently about SQL Server and it covered these as well.

 haha it feels good when you say that i got the basics right 😛
 still, i have the questions about your example.  let's me rephrase your last paragraph where you introduce a more complicated problem. so in order to make the new unique column (joint of many columns) work in my data tables. this new column need to be created identically in both tables? but isnt that contradicting with what you said earlier "The unique values only need to exist in 1 of the 2 tables"??

thanks

Anonymous
Not applicable

The column has to exist in both tables, but the values only need to be unique in a single table.  In the Sales/Employees example, an employee ID is unique in the Employees table, but is not unique in the Sales table.  This is because a single employee can have multiple sales.

 

When you create a combined Key, since we have to relate 2 single columns, you need this column in both tables or else you have nothing to join.

 

Does that clear it up?

oh yes!!! thank a lots. it really makes my head less foggy. 
i prob will need some more time to really digest this new info. but it feels like i got it now

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.