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
Anonymous
Not applicable

Newbie Data Lookup

Good Day,

 

I was wondering if anyone could assist me with a data structure. I have a master reference table that contains multiple columns. The first column is a unique number/text and the second is a descriptor and 3rd an addtional descriptor and the rest is not relevent.

 

I then have a second table(daily) that contains only 2 fields but the 2nd field has a numeric value. And the first field would need to match the 1st field of the master table. This would then lookup the items based on the unique number and show me the 2nd column of the second table(daily). The data result would then Read: 6955266202337, CASTLE SERIES: KNIGHTS SMALL BALLISTA 27 PCS 1006, 122

 

See below: Any assitance would be appreciated.

 

Table 1 (Master) 
CodeDescMan
6955266102323
CASTLE SERIES: KNIGHTS PAY CAR 25 PCS 1005MIN002
6955266202337CASTLE SERIES: KNIGHTS SMALL BALLISTA 27 PCS 1006MIN002
6955266302341CASTLE SERIES: KNIGHTS TRANSPORT BOATS 30 PCS 1007MIN002
6955265623744CASTLE SERIES: KNIGHT OF EAGLE 10 PCS 1010MIN002

 

Table2 (Daily) 
Code
Qty
6955266202337122
3 ACCEPTED SOLUTIONS

This is the foundation of Power BI. You need to join the 2 tables with a relationship in the relationship view. The rest will just work, as long as that column in the first table is unique (as you suggest). 

 

You may like to read my article about Relationships In Power BI.



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

You are not allowed blanks in the table on the 1 side of the relationship.  Remove the blanks with Power Query first.



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

In Query Editor mode, select the [Code] field in Table1, then, remove empty and remove duplicates.

1.PNG     2.PNG

 

Then, in data view mode, add a calculated column in Table2 with LOOKUPVALUE function.

New Column =
LOOKUPVALUE ( Table1[Desc], Table1[Code], Table2[Code] )

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

In Query Editor mode, select the [Code] field in Table1, then, remove empty and remove duplicates.

1.PNG     2.PNG

 

Then, in data view mode, add a calculated column in Table2 with LOOKUPVALUE function.

New Column =
LOOKUPVALUE ( Table1[Desc], Table1[Code], Table2[Code] )

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is the foundation of Power BI. You need to join the 2 tables with a relationship in the relationship view. The rest will just work, as long as that column in the first table is unique (as you suggest). 

 

You may like to read my article about Relationships In Power BI.



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Hi Matt,

 

Thank you for your response, I double checked that the master table doesnt contain duplicates on the 1st row, but yet I still get the error message about one tables column must contain unique values. I see on the one table the data is blank but is visible why I click the drop down on the filter?

 

Any ideas?

 

 

 

You are not allowed blanks in the table on the 1 side of the relationship.  Remove the blanks with Power Query first.



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Hello Matt,

 

I double checked that there is no blanks in the first table and yet the relationship cannot be established.

 

Please help 

ValentinBIA
Resolver I
Resolver I

Hi @Anonymous,

 

In Power BI you have something much more powerfull and easy to use the basic lookup.

 

To do what you are looking to, you should:

- Charge your 2 tables in 2 different queries

- Make sure the Type of your Code column is the same in both queries (text or number, doesn't matter)

- Go to the main query

- In the home upper ribbon, click merge querries (top right)

- Select your second query, and for both, select the code column.

- Press OK

- Click the small expand icon on the new column

- Press OK

 

There you go, you can now rename your columns and delete the ones that are not useful

 

Hope that helps

Best,

Valentin

Did I answer your question? Mark my post as a solution!

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.