Forum Discussion
Shelley
Post Prodigy
7 years agoHow to lookup values in another table in the Query Editor?
Does anyone know if/how this can be done? I have a table in the Query Editor that has a number of fields, one of which is the Customer #. I want to make a new column in this table that contains R...
- 7 years ago
Hi Shelley,
Please check out the demo in the attachment. It's a solution in Power Query (the Custom column).
(let currentCustomer = [CustomerName] in Table.SelectRows(Table1, each [CustomerName] = currentCustomer)){0}[CustomerID]Best Regards,
Dale
Shelley
Post Prodigy
7 years agoThe reason I want to do this is because I need to make a Key column that is Customer#|Region. I am trying to tie a whole bunch of fact tables together with a Link Table, using the key I create from customer# + region. If I don't create the key in the Query Editor, I was thinking the DAX will be slower.
MFelix
Super User
7 years agoHi Shelley,
Is the customer region ID column you want to create have the sam customer for more tha 1 region?
Not sure of the expected result and model you have but you could create an additional column with region only and make also a relation between this and the fact tables.
Can you give more insight on your data and expected result?
Don't advise on create additional columns of Customer/region ID since i will bring size and complexety to your model.
Regards
MFelix
Is the customer region ID column you want to create have the sam customer for more tha 1 region?
Not sure of the expected result and model you have but you could create an additional column with region only and make also a relation between this and the fact tables.
Can you give more insight on your data and expected result?
Don't advise on create additional columns of Customer/region ID since i will bring size and complexety to your model.
Regards
MFelix
- Shelley7 years ago
Post Prodigy
Yes, the same customer# can be responsible for more than one region. I also have a number of diverse fact tables. So I need the unique key to tie all the fact tables together correctly.
- MFelix7 years ago
Super User
Hi Shelley,
The using merge you can select what columns to show after merge and then you can delete the additionals after making the ID column.
However believe that the best setup is not.this.you should have a customer.table as you have and a region table thenake the.connection between tables.using.this.two.tables.
Can you share some.sample.data and expected result?
Regards.
MFelix