![]() |
Real-world data is always messy. There will be always in need for adding new columns from one table to another because no table will have complete information. Adding a column allows for more efficient data analysis as well as the ability to add additional information to the table. Adding a column from one table to another helps us to combine data from separate tables that have related information this is an added advantage to draw meaningful insights from data. By getting columns from one table to another we can understand relationships between the tables easily which makes it easier to analyze the data for making decisions based on the information. Steps to Get a Column from One Table to Another in PowerFor a better understanding, we need to see this by using a practical example. Consider two tables, sales_table: Which contains sales information of products in INDIA for the year 2019,2020. To access the sales_table click ![]() sales_table product_table: This contains information about the products and their owners who bought them in INDIA for the year 2019,20202. To access the product_table click ![]() product_table Here we wanted to get the product_owner column from the product_table to the sales_table for this we have 4 different ways. Four Ways to get a Column from One Table to Another1. The first way is by using the Related function. What RELATED Function do in power-bi? The name itself indicates that this function returns the value from the other related table. This function works when we have a relation between the tables.
![]()
2. The second way of doing this is by using the LOOKUPVALUE function. LOOKUPVALUE function is used to retrieve the value from another table. The name itself indicated that it looks up the value from one table to another related table. Both the LOOKUPVALUE function and RELATED functions perform the same operation but the only difference is SYNTAX and the internal operation of the RELATED function. The LOOKUPVALUE function syntax is difficult to understand when compared to the RELATED function. Whereas the RELATED function itself relates to the table without any manual specification. This function works when we have a relation between the tables.
![]()
3. The third way of doing it is using the CALCULATE Function. CALCULATE function is the most used dynamin function in power bi. It works as a base function to apply another function through DAX. Here by using CALCULATE function we are applying the VALUES function to get distinct values according to the relationship between the tables. The VALUES function is used to get distinct values when a column name is given to know more about the VALUES function you can go through this blog values function.
Note: This function works when we have a relation between the tables.
![]()
4. The final way to do it is by using the Merge queries option in Transform data.
![]()
![]()
![]()
![]()
![]()
![]()
Here is the OUTPUT screenshot using merge queries. ![]()
|
Reffered: https://www.geeksforgeeks.org
Misc |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 16 |