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.
Hi all,
I'm having a master table containing product numbers in scope from which I want to lookup values in from other sources/tables.
The values to one of the columns in the master table needs to lookup one value from multiple tables per product number. All product numbers are clustered in groups/tables having different columns and number of columns but all share the same column "Availability" which is comparable across. This columns is the one from which I need to lookup in. A product number only exist once across the lookup tables.
The lookup tables looks simplified like this (I'm having 10 tables)
Product number | x | y | Availability |
123 | xxx | yyy | 10% |
234 | xxx | yyy | 20% |
and
Product number | x | y | z | Availability |
345 | xxx | yyy | zzz | 15% |
456 | xxx | yyy | zzz | 22% |
And the master table are supposed to look like this after the lookup
Product number | Availability |
123 | 10% |
234 | 20% |
345 | 15% |
456 | 22% |
Any great suggestions to solve this? 🙂
Best regards,
Nichlas
Solved! Go to Solution.
hi @nbrandborg I think it may work. I used the below code snippet.
Availability =
LOOKUPVALUE(Product_LookupTable[Availability],Product_LookupTable[Product number],Product_Master[Product number])
New_Column_Master =
LOOKUPVALUE(Product_LookupTable[New_Column],Product_LookupTable[Product number],Product_Master[Product number])
Did I answer your question? Mark my post as a solution! It helps others.
hi @nbrandborg you can try like this; I am not sure about your data model.
1. Create a lookup table, by merging all 10 tables, like this.
Product_LookupTable =
Union(
SELECTCOLUMNS(Table1, "Product number", Table1[Product number],"Availability", Table1[Availability]),
SELECTCOLUMNS(Table2, "Product number", Table2[Product number],"Availability", Table2[Availability])
)
2. Create a new column in Product Master table like thhis.
Availability =
LOOKUPVALUE(Product_LookupTable[Availability],Product_LookupTable[Product number],Product_Master[Product number])
Did I answer your question? Mark my post as a solution! It helps others.
@pradeept it was not a bad idea, and definately not something I had considered. But tried implementing it and it worked fine!
I considered expanding it and tried to take in another column to make the table more useful and central for lookups. Unfortunately I did not succeed in importing another column. The columns comes from the same supporting tables and has the same logic as 'availability'.
Can the function be altered to take more columns in still based on the product numbers.
hi @nbrandborg I think it may work. I used the below code snippet.
Availability =
LOOKUPVALUE(Product_LookupTable[Availability],Product_LookupTable[Product number],Product_Master[Product number])
New_Column_Master =
LOOKUPVALUE(Product_LookupTable[New_Column],Product_LookupTable[Product number],Product_Master[Product number])
Did I answer your question? Mark my post as a solution! It helps others.
@nbrandborg I'm not sure I'm following your predicament. Can you post a depiction of your model?
Proud to be a Super User!
Paul on Linkedin.
@nbrandborg , as lookup can work across two tables only .
You might have to try something like this with 10 tables
new column =
var _1= maxx(filter(Table1, Table1[Product number] = master[Product numbe]),table1[Availability])
var _2= maxx(filter(Table2, Table1[Product number] = master[Product numbe]),table2[Availability])
//add other
Switch(true() ,
not(isblank(_1)) ,_1 ,
not(isblank(_2)) ,_2 ,
//add for other 8
0)
@amitchandak
Thank you for providing a solution.
I just tried to set it up partly with some of the tables, but I get an syntax error around the 'switch' expression.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |